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:

herong> java -Xmx24m GarbageCollection
Free/total memory:
23725256   25034752
22710400   25034752
21618728   25034752
20523584   25034752
...

(Start another command window.)
herong> jps -l -m
10672 GarbageCollection
1256 jdk.jcmd/sun.tools.jps.Jps -l -m

herong> jmap -dump:file=GarbageCollection.map 10672
Heap dump file created

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

 About This Book

 Java Tools Terminology

 Java Tools Included in JDK

 javac - The Java Program Compiler

 java - The Java Program Launcher

 jar - The JAR File Tool

 jlink - The JRE Linker

 jmod - The JMOD File Tool

 jimage - The JIMAGE File Tool

 jpackage - Binary Package Builder

 javadoc - The Java Document Generator

 jdeps - The Java Class Dependency Analyzer

 jdeprscan - The Java Deprecated API Scanner

 jdb - The Java Debugger

 jcmd - The JVM Diagnostic Tool

 jconsole - Java Monitoring and Management Console

 jstat - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

 JVM Troubleshooting Tools in JDK

 jinfo - VM Option Value Checker

 jinfo - Changing HotSpot VM Option

 jstack - Stack Tracer to Generate Thread Dump

 What Is a Thread Dump?

 Java Thread Deadlock Demo Program

 jstack - Detecting Java Thread Deadlocks

 jmap - JVM Heap Dump Tool

 Printing Histogram of Java Object Heap

jmap - Generating Heap Dump File

 jhat - Java Heap Analysis Tool

 jhat - Starting Web Server on a Heap Dump File

 Listing Instance Counts of All Classes

 Browsing Object Instance Values

 Object Query Language (OQL)

 Searching for Instances with OQL Statements

 jhsdb - The Java HotSpot Debugger

 jvisualvm (Java VisualVM) - JVM Visual Tool

 jmc - Java Mission Control

 javap - The Java Class File Disassembler

 keytool - Public Key Certificate Tool

 jarsigner - JAR File Signer

 jshell - Java Language Shell

 jrunscript - Script Code Shell

 Miscellaneous Tools

 native2ascii - Native-to-ASCII Encoding Converter

 JAB (Java Access Bridge) for Windows

 Archived Tutorials

 References

 Full Version in PDF/EPUB