File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Performance
Bookmark "java garbage collection" Watch "java garbage collection" New topic

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

Joined: May 14, 2008
Posts: 5852

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:, especially the graph on object lifetimes.

JBoss In Action
I agree. Here's the link:
subject: java garbage collection
It's not a secret anymore!