'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.

    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.

    Prints information on objects awaiting finalization.

    Prints a heap summary. GC algorithm used, heap configuration and 
    generation wise heap usage are printed.

    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.

    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. 

    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:


    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)

      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

 About This Book

 Java Tools Terminology

 Installing Java 8 on Windows

 'javac' - The Java Program Compiler

 'java' - The Java Program Launcher

 'jdb' - The Java Debugger

 'jconsole' - Java Monitoring and Management Console

 'jstat' - JVM Statistics Monitoring Tool

JVM Troubleshooting Tools

 JVM Troubleshooting Tools in JDK 1.5

 'jinfo' - VM Option Value Checker

 Changing HotSpot VM Option using 'jinfo'

 'jstack' - Stack Tracer to Generate Thread Dump

 What Is a Thread Dump?

 Java Thread Deadlock Demo Program

 Detecting Java Thread Deadlocks with 'jstack'

'jmap' - JVM Heap Dump Tool

 Printing Histogram of Java Object Heap

 Generating Heap Dump File with 'jmap'

 'jhat' - Java Heap Analysis Tool

 Starting 'jhat' 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

 jvisualvm (Java VisualVM) - JVM Visual Tool

 'jar' - The JAR File Tool

 'javap' - The Java Class File Disassembler

 'keytool' - Public Key Certificate Tool

 'native2ascii' - Native-to-ASCII Encoding Converter

 Outdated Tutorials


 PDF Printing Version