aspose file tools*
The moose likes Performance and the fly likes java garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "java garbage collection" Watch "java garbage collection" New topic
Author

java garbage collection

luri ron
Ranch Hand

Joined: Dec 11, 2008
Posts: 87
while tuning the gc parameter, why do we sometimes want to allow object to age more in the young generation before the objects are moved the old generation? is it because the young generation collector perform better than the old generation collector? or is it more expensive to move the memory from young generation to old generation during gc? thanks.
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Major collection typically take longer than minor collections, therefore you want to delay moving objects to the tenured generation as long as possible. By having a high tenuring threshold, there is a greater chance that an object will go out of scope and become unused and be cleaned up by a minor collection.

Of course, if you have objects that expect to survive a long time, then you would really want to move them to the tenured generation as soon as possible. But analysis of heap object has shown that short lived objects vastly outnumber long lived objects, so the preference is to have a high tenuring threshold.

See also: http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html, especially the graph on object lifetimes.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java garbage collection