How to use jvisualvm to find memory leaks?

Daniel Fuchs daniel.fuchs at
Thu Aug 14 08:47:51 UTC 2014

On 8/14/14 10:02 AM, Wang Weijun wrote:
> I am looking at "8054896: Loading a KeyStore prevents GC of Classloader" and am now able to reproduce it on my system. I do see the webapp-related classes present in a heapdump created by VisualVM but not sure what the next steps should be to tell why they are not GC'ed. Is there a good tutorial on this?
> Thanks
> Max

Hi Max,

If you are able to determine which instance of which classes should
have been garbage collected but weren't, the next step would
be to select one of them and ask jvisualvm to find the
nearest GC root.

That should give you a hint of who is holding a reference to
the instance.

The next step - often harder - is to figure out why.

hope this helps,

-- daniel

More information about the core-libs-dev mailing list