Avoid collecting young gen while doing the full GC
Y. Srinivas Ramakrishna
Y.S.Ramakrishna at Sun.COM
Wed Mar 24 01:12:02 UTC 2010
I just checked, and ...
Y. Srinivas Ramakrishna wrote:
> Good point. You'd think that the current compacting collectors would
> do this (either in the pointer update phase or as you suggest the short-cut
> of conditionally dirtying the entire old and perm gens) if the compacted
> data did not all fit in the old gen and some of it overflowed into
> young. I haven't looked at the code in a while, and I wonder which
... (Serial) mark-compact (at least) does the latter. (Probably makes sense in most
conventional scenarios where overflow is rare.) John if you are reading this
perhaps you can tell us what parallel compact does? (Or i'll eventually get around to
looking at it :-)
> (if either, yikes!) is actually done. I'll take a look when i get
> some free time unless someone else gets to it first ;-)
> -- ramki
> Tony Printezis wrote:
>> You also have to make sure that the card table (the data structure
>> that keeps track of old-to-young refs) is left consistent at the end
>> of the GCs. So, as you move old objects that point to the young gen,
>> you might have to update the card table accordingly. An easy way to do
>> that (good to at least make sure that the rest of the implementation
>> is working correctly) is to dirty the cards of the entire old gen.
>> This will make the next young GCs really slow, but the young collector
>> should deal with it correctly and clean up the card table as necessary.
>> I'm also curious why you want to do this. My wild guess would be that
>> you're maybe using a huge young gen, relatively to the old gen, and as
>> a result it's better to let the young collector deal with it rather
>> than compacting it (which would be much slower).
>> Y. Srinivas Ramakrishna wrote:
>>> Hi Tony --
>>> On 03/23/10 10:57, Tony Guan wrote:
>>>> Hi all,
>>>> In my current project, one crazy idea is to leave the young generation
>>>> untouched(not collected) during a Full Gc. Is it feasible if I want to
>>>> collect the tenured gen only in a full GC?
>>>> To do this, the young gen should be included as part of the root set,
>>>> and the reference processor should only care about the old gen. Is
>>>> there anything else I should take care of?
>>> Yes, i believe that should work. (In fact, the CMS collector, which
>>> only the old gen and perm gen, does pretty much that. There are some
>>> to it though, for example, dead objects in the young gen possibly
>>> objects in old and perm gen artificially alive, but such cases are
>>> Just out of curiosity, when and wny would you want to not collect the
>>> young gen?
>>> -- ramki
More information about the hotspot-gc-dev