ExplicitGCInvokesConcurrentAndUnloadsClasses leaks PermGen
mikael.gerdin at oracle.com
Tue Aug 27 05:35:17 UTC 2013
The situation I described only affects concurrent collections with CMS.
If the explicit GC is STW (and thereby recorded as a Full GC in the log)
then you should not be seeing any issues.
Please make sure that you don't leak classes as it is very easy to miss due
to the implicit reference from Java object->Class->ClassLoader.
On 26 August 2013 23:26:12 Jungwoo Ha <jwha at google.com> wrote:
> 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...
More information about the hotspot-gc-dev