Java memory map (jmap) tool

Use the jmap tool to get memory information for a particular Java™ process, or list of processes. The tool shows statistics about classes on the heap, including the number of objects and their aggregate size. The command syntax is as follows:

jmap [<option>] [<vmid>]

<vmid> is the Attach API virtual machine identifier for the Java process. This ID is typically the same as the operating system process ID, unless you specified the -Dcom.ibm.tools.attach.id system property when you started the process.

VMID is shown in jps or other Attach API-based tools. Multiple VMIDs can be specified, separated by a space.

If you do not specify a VMID, the command reads input from stdin. You can therefore get information for all processes by piping the output of the jps command to jmap:

jps -q | jmap -histo

IDs of dead processes are silently ignored.

On its own, jmap prints help information. To obtain memory information, a -histo argument must be supplied, where the available <options> are as follows:

The output has the following format:

num   object count     total size    class name
-------------------------------------------------
  1           3354         107328    [C
  2            717          57360    java.lang.Class
  3           2427          38832    java.lang.String
  4             50          13200    [J
  5            717          11472    java.lang.J9VMInternals$ClassInitializationLock
  6            342           8208    java.lang.StringBuilder
  7            151           7248    jdk.internal.org.objectweb.asm.Item
  8            396           6336    [Ljava.lang.Object;

Restrictions: This tool is not supported and is subject to change or removal in future releases. Although similar in usage and output to the HotSpot tool of the same name, this tool is a different implementation that is specific to Eclipse OpenJ9™.

The following tool limitations apply:

The tool uses the Attach API, and has the following limitations:

For more information about the Attach API, including how to enable and secure it, see Java Attach API.