I am attempting to debug a permgen error in an application. I am running VisualVM to profile the app and have taken a heapdump of the memory snapshot.
Loading the snapshot into VisualVM for analysis, I can currently see in the classes list several classes appearing several times, all listed with 0 instances, 0 size - I am only expecting one of these classes each (probably linked to its classloader) - Is there any way to determine what is still holding references to these classes with no instances? Happy to use another tool if I can just load in the dump(.hprof) to analyze what is holding the reference.
Thanks!
Well, saying "use MAT" doesn't really answer the question!
To do it in VisualVM, in the Sampler or Profiler view there is a button (top right) labeled "Heap Dump". Click this, which opens the heap analyser. Under the "Classes" tab, all loaded classes are shown. At the bottom there is a search box, type the class name you are interested in, in the filtered view double click the class in question.
This opens the instances view. Right-click an instance int the left pane, and select "Show Nearest GC Root" to find what is referencing the object.
Barney
I use MAT for stuff like this. Works great, even on large heaps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With