Java Tools Tutorials - Herong's Tutorial Notes - Version 5.32, by Dr. Herong Yang
'jmap' - JVM Heap Dump Tool
This section describes the JVM heap dump tool, 'jmap', command and its options. Windows version of 'jmap' can print heap histogram and generate heap dump.
"jmap" - Memory Map: Prints shared object memory maps or heap memory details of a given JVM process or a Java core file on the local machine or on a remote machine through a debug server. "jmap" supports several functions with these syntaxes:
jmap [ option ] pid jmap [ option ] executable core jmap [ option ] [server-id@]remote-hostname-or-IP <no option> When no option is used jmap prints shared object mappings. For each shared object loaded in the target VM, start address, the size of the mapping, and the full path of the shared object file are printed. This is similar to the Solaris pmap utility. -dump:[live,]format=b,file=<filename> Dumps the Java heap in hprof binary format to filename. The live suboption is optional. If specified, only the live objects in the heap are dumped. To browse the heap dump, you can use jhat (Java Heap Analysis Tool) to read the generated file. -finalizerinfo Prints information on objects awaiting finalization. -heap Prints a heap summary. GC algorithm used, heap configuration and generation wise heap usage are printed. -histo[:live] Prints a histogram of the heap. For each Java class, number of objects, memory size in bytes, and fully qualified class names are printed. VM internal class names are printed with '*' prefix. If the live suboption is specified, only live objects are counted. -permstat Prints class loader wise statistics of permanent generation of Java heap. For each class loader, its name, liveness, address, parent class loader, and the number and size of classes it has loaded are printed. In addition, the number and size of interned Strings are printed. -F Force. Use with jmap -dump or jmap -histo option if the pid does not respond. The live suboption is not supported in this mode.
The "jmap" tool included in the Windows version of JDK supports functions to print histogram of Java object heap and generate a heap dump of a given JVM process:
C:\herong>\Progra~1\java\jdk1.8.0\bin\jmap Usage: jmap -histo <pid> (to print histogram of java object heap of the JVM process) jmap -dump:<dump-options> <pid> (to dump java heap of the JVM process) dump-options: format=b binary default file=<file> dump heap to <file> Example: jmap -dump:format=b,file=heap.bin <pid>
See the next section on how to use "jmap" to print heap histogram and to generate heap dump.
Last update: 2015.
Table of Contents