Avoid collecting young gen while doing the full GC

Tony Guan guanxiaohua at gmail.com
Tue Mar 23 19:45:59 UTC 2010


Hi Ramki,

Thanks!

In my study, I want to reclaim some clustered objects all at once
instead of relying on regular GCs. To achieve this goal, I need to
reserve  in the heap some space which is free of garbage collections.
Does this idea sound familiar to you or just another crazy one?

Actually, I am stuck somewhere implementing it. I know what to do
generally, but down to the code, I am really lost.

I tried not to expand the span of the ref processor, so refs discovery
is over just the old generation in the method
OneContigSpaceCardGeneration::collect(), but this doesn't do the
trick, a full GC will still collect everything. So I just keep staring
at the code currently.

Do you have any hint for me?

Thanks!

Tony



On Tue, Mar 23, 2010 at 2:27 PM, Y. Srinivas Ramakrishna
<Y.S.Ramakrishna at sun.com> 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