javamemorygarbage-collectionjvmjmap

What does "jmap -histo pid" print exactly


I am using the command "jmap -histo pid" and want to know what it is exactly telling me.

The output is something like:

 num     #instances         #bytes  class name
----------------------------------------------
   1:       2284437      262114728  [C
   2:        686409      124390432  [B
   3:        363878       46799288  <constMethodKlass>
   4:        363878       46590464  <methodKlass>
   5:       1817209       43613016  java.lang.String
   6:         34590       37296528  <constantPoolKlass>
   7:        296302       36673344  [I
   8:         34585       33237656  <instanceKlassKlass>
   9:        248731       21559504  [Ljava.lang.Object;
  10:         28200       19991872  <constantPoolCacheKlass>
  11:        563323       13519752  scala.collection.immutable.$colon$colon
  12:         26813       13103488  <methodDataKlass>
  13:        506968       12167232  scala.collection.immutable.HashSet$HashSet1
  14:        200750       10371320  [Lscala.collection.immutable.HashSet;
  15:        114268        9477096  [Lscala.collection.immutable.HashMap;
  16:         92405        7392400  java.lang.reflect.Method
  17:        200953        6430496  scala.collection.immutable.HashMap$HashMap1

By example: What's "bytes" exactly displaying?

  1. Is it the average size per instance of this type
  2. Is it the total size of all objects which were created since start of the app
  3. Is it the current allocated size in the heap of all objects

Maybe someone can explain to me what's "#instances" aswell.


Solution

  • This is the summary of current Java Heap contents grouped by the object class.