Java Tools Tutorials - Herong's Tutorial Examples - Version 6.20, by Dr. Herong Yang
jmap - Generating Heap Dump File
This section provides a tutorial example on how to generate a heap dump file with the 'jmap -dump:file=name' command. A heap dump file contains all heap objects of JVM process.
The second function of the "jmap" tool is to generate a heap dump of a given JVM process with the "jmap -dump:file=<filename>" command:
C:\herong>java -Xmx24m GarbageCollection Free/total memory: 23725256 25034752 22710400 25034752 21618728 25034752 20523584 25034752 ... (Start another command window.) C:\herong>jps -l -m 10672 GarbageCollection 1256 jdk.jcmd/sun.tools.jps.Jps -l -m C:\herong>jmap -dump:file=GarbageCollection.map 10672 Heap dump file created C:\herong>dir *.map 22,306,616 GarbageCollection.map
So the heap dump file, "GarbageCollection.map", is a snapshot of all heap objects used by the running GarbageCollection.java process. The size of the heap dump file should be the same as all currently allocated objects in the heap.
Table of Contents