ExplicitGCInvokesConcurrentAndUnloadsClasses leaks PermGen

Jungwoo Ha jwha at google.com
Mon Aug 26 21:26:12 UTC 2013

Hi Mikael,

Does this also happen if the Explicit GC is STW?
I have been reported that it also happens in STW Explicit GC.
Much rarely though.


On Wed, Aug 14, 2013 at 11:43 PM, Mikael Gerdin <mikael.gerdin at oracle.com>wrote:

> Hi,
> On 08/15/2013 02:37 AM, Jungwoo Ha wrote:
>> Hi,
>> Is ExplicitGCInvokesConcurrentAnd**UnloadsClasses guaranteed to unload
>> all
>> unused classes?
>> We installed weak reference on the class objects to see none of the
>> class objects are leaked.
>> When using STW Explict GC all of the unused classes are unloaded,
>> but when using above flag, only some are get unloaded.
>> I double-checked the GC log and waited until the concurrent GC to finish
>> its job.
>> Is this an expected behavior or a bug?
>> BTW, The leak detecting code using weak reference is used for a long time,
>> which I think is quite stable.
>> Any comments are appreciated!
> A caveat with CMS and class unloading is that CMS treats all objects in
> the young generation as strong roots. You need to make sure that you've
> triggered enough young GCs so that your weak references are promoted out of
> the young gen before triggering the explicit CMS cycle.
> If you have a small test case you can try reducing the young gen size and
> setting MaxTenuringThreshold=1 and see if all the classes get unloaded as
> you expected.
> /Mikael
>> Thanks,
>> Jungwoo Ha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/attachments/20130826/93229ad6/attachment.htm>

More information about the hotspot-gc-dev mailing list