Avoid collecting young gen while doing the full GC
Tony Guan
guanxiaohua at gmail.com
Tue Mar 23 19:59:13 UTC 2010
Hi Big Tony,
Thank you for the reply. As explained by my previous email to Ramki,
I need to reserve one space to store some special objects for a
once-for-all wipeout. After I disabled the space extension in the
reference processor, I am really waiting for some exceptions from the
assertions(either from the card marking or null pointer exception),
but to disappoint me, the full GC just finish without any problem, and
the young gen is still collected during a full GC.
This is a rare case that a developer will expect some exceptions from
his program.
And many thanks to Ramki, I will take a look at the CMS collector for a clue.
Thanks!
Tony
On Tue, Mar 23, 2010 at 2:44 PM, Tony Printezis <tony.printezis at sun.com> wrote:
> Tony,
>
> 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).
>
> Tony
>
> 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
>> collects
>> only the old gen and perm gen, does pretty much that. There are some
>> disadvantages
>> to it though, for example, dead objects in the young gen possibly keeping
>> objects in old and perm gen artificially alive, but such cases are
>> probably
>> rare.)
>>
>> Just out of curiosity, when and wny would you want to not collect the
>> young gen?
>>
>> -- ramki
>>
>>>
>>> Thanks!
>>>
>>> Tony
>>
>
More information about the hotspot-gc-dev
mailing list