Are there any tools that are able to get Metaspace dump from a Java8 hotspot vm ?
They live in a native memory region outside of the Java heap. That region is called Metaspace.
The Metaspace takes up a significant portion of the JVM's Non-Heap memory. Its main purpose is to store class metadata — the internal runtime representation of Java classes. By default, the metaspace is comprised of two parts — the Class Space and the Non-Class Space.
They are very useful to troubleshoot memory-leak problems and optimize memory usage in Java applications. In order to capture a heap dump automatically, we need to add the HeapDumpOnOutOfMemoryError command-line option that generates a heap dump when a java. lang. OutOfMemoryError is thrown.
It seems you encounter a class loading leak.
Use
jmap -clstats PID
to dump class loader statistics;jcmd PID GC.class_stats
to print the detailed information about memory usage of each loaded class. The latter requires -XX:+UnlockDiagnosticVMOptions
.The heap dump will also help, because each class in the Metaspace has a corresponding java.lang.Class
instance in the heap.
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