jmap - Java Memory Map Printer

In this article we are going to elaborate the jmap command tool which is a part of JAVA commands (comes with jdk package). This article is the continuation of this previous article.

As we know the standard format of commands in java, the jmap command also have the format(in command prompt)
jmap [option] pId
jmap [option] exe core
jmap [option] [server-id@]remote-hostname-or-IP

In here ,
pId = Java process id (use jps to get the info)
exe = Java executable from which the core dump was produced.
core = Core file for which the stack trace is to be printed.
remote-hostname-or-IP = Debug server's (see jsadebugd) hostname or IP address.
server-id= (optional) unique server id

jmap prints shared object memory maps/heap memory details of a given process/core file/a remote debug server.

jmap Options : 
With no option is used jmap prints shared object mappings. This is similar to the Solaris pmap utility.

-dump:[live,]format=b,file=[filename] : Dumps the Java heap in hprof binary format to filename.
live : objects in the heap are dumped(optional).
format=b : Binary default
file=[filename] : dump heap to filename

-finalizerinfo : Prints information on objects awaiting finalization.
-heap : Prints a heap summary(GC algorithm ,heap configuration ,generation wise heap)
-histo[:live] : Prints a histogram of the heap.
-permstat :Prints class loader wise statistics of permanent generation of Java heap( the number and size of interned Strings are also printed)
-F : Force(Use with jmap -dump or jmap -histo option when pid is not responding)
-J[option]: Passes option to the Java virtual machine on which jmap is running.

Note :
-If the given process is running on a 64-bit VM, we need to specify the -J-d64 option.
-In windows, the system path variable should contain jvm.dll(for my PC, it is in C:\Program Files\Java\jre6\bin\server).


No comments:

Post a Comment