Reputation: 3151
I have recently migrated from Java7 to Java8. This has caused an issue where I get OutOfMemoryException
after a few hours because the GC can't free any memory. Also, the Last Ditch Collection can't resize the Metaspace to anything bigger.
I am quite convinced that this is an issue caused by a huge amount of classes being loaded by reflection. Unfortunately, I can't find a way to see what classes are being loaded. Is there a way to extract that information from a heap dump?
Upvotes: 1
Views: 337
Reputation: 201
You need Java Mission Control (jmc.exe) that comes with JDK to record the events on your application. Here is how you go: 1. Start jmc.exe from bin directory 2. Start recording. Select if you want whole or time limited recording. 3. Dump the recording. 4. Happy debugging.
Specifically, you can go to Memory tab -> Allocations -> Allocations by TLAB This gives the classes loaded and from where they are loaded.
Happy debugging.
Upvotes: 1
Reputation: 240946
You could pass
-verbose:class
to JVM to print what classes are being loaded
Upvotes: 2