January 2018
Intermediate to advanced
350 pages
9h 7m
English
Sometimes, you will need to get a heap dump to investigate what is in memory and why the GC runs so often or for so long. To do so, the JDK provides a tool called jmap that allows you to take a dump from the Java PID:
jmap -dump:format=b,file=/path/to/dump.hprof <PID>
This command will stop the application (a bit like a stop the world pause) and write all the instances into the configured file. Opening the output with jvisualvm will enable you to investigate the instances, and, in particular, the number of instances and the corresponding allocating size.
Here is what it can look like:

Normally, you should mainly see JVM classes such ...
Read now
Unlock full access