Tavo Tavo - 8 months ago 41
Java Question

Metaspace throwing OutOfMemoryException

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?

Answer

You could pass

-verbose:class

to JVM to print what classes are being loaded