jmap
The jmap
tool is used to obtain information about the memory consumed by the JVM. It is very similar to the native pmap
tool provided by many operating systems. As with the jstack
tool, jmap
can be invoked against a running Java process by providing the process ID or against a core file. For example:
jmap <processID> jmap <pathToJava> <pathToCore>
Some of the additional arguments include:
-dump:
live,format=b,file=filename
-
Dumps the live heap data to a file that can be examined by the
jhat
tool. -heap
-
Provides a summary of the memory used in the Java heap, along with information about the garbage collection algorithm in use.
-histo:
live
-
Provides a count of the number of objects of each type contained in the heap. If the
live
option is included, then only live objects are included; otherwise, the count includes objects that are no longer in use and are garbage collected.