Thursday, February 10, 2011

Use of jmap command?

hey Guys if you want to know the secrets of the JVM and its behavior here is a useful command.

which will give you the important information about the JVM memory Mappings.

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

       NOTE - This utility is unsupported and may or may not be  available  in
       future  versions  of  the J2SE SDK.  jmap is not currently available on
       Windows platforms or on the Linux Itanium platform.

 Usage

     jmap [option] pid
     jmap [option] executable core
     jmap [option] [server-id@]remote-hostname-or-IP


OPTIONS

<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.
-heap             Prints  a  heap  summary.  GC  algorithm used, heap configuration and generation wise heap
                      usage are printed.

 -histo            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.
-permstat      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.
 

 -h                  Prints a help message.
Example  


jmap -heap 2709


using thread-local object allocation.
Mark Sweep Compact GC

Heap Configuration:

   MinHeapFreeRatio = 40
   MaxHeapFreeRatio = 70
   MaxHeapSize      = 67108864 (64.0MB)
   NewSize          = 655360 (0.625MB)
   MaxNewSize       = 4294901760 (4095.9375MB)
   OldSize          = 1441792 (1.375MB)
   NewRatio         = 12
   SurvivorRatio    = 8
   PermSize         = 8388608 (8.0MB)
   MaxPermSize      = 67108864 (64.0MB)

Heap Usage:
New Generation (Eden + 1 Survivor Space):
   capacity = 589824 (0.5625MB)
   used     = 384136 (0.36634063720703125MB)
   free     = 205688 (0.19615936279296875MB)
   65.12722439236111% used
Eden Space:
   capacity = 524288 (0.5MB)
   used     = 382816 (0.365081787109375MB)
   free     = 141472 (0.134918212890625MB)
   73.016357421875% used
From Space:
   capacity = 65536 (0.0625MB)
   used     = 1320 (0.00125885009765625MB)
   free     = 64216 (0.06124114990234375MB)
   2.01416015625% used
To Space:
   capacity = 65536 (0.0625MB)
   used     = 0 (0.0MB)
   free     = 65536 (0.0625MB)
   0.0% used
tenured generation:
   capacity = 7544832 (7.1953125MB)
   used     = 6702600 (6.392097473144531MB)
   free     = 842232 (0.8032150268554688MB)
   88.83696813925081% used
Perm Generation:
   capacity = 8388608 (8.0MB)
   used     = 4809184 (4.586395263671875MB)
   free     = 3579424 (3.413604736328125MB)
   57.32994079589844% used

Keep Rocking Guys.....

1 comment:

  1. if i want to calculate heap memory & non-heap memory for any java application what would be the command for this ?

    ReplyDelete