Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are these objects in the jmap histogram? [duplicate]

Tags:

java

memory

jmap

I'm using jmap to get a histogram of the heap. I'm not sure what the objects are that are referred to as "[C", "[S", "[I" and "[B". Anyone know?

$ jmap -histo 3299

 num     #instances         #bytes  class name
----------------------------------------------
   1:          9804       19070632  [Ljava.util.HashMap$Entry;
   2:         38074        6216960  [Ljava.lang.Object;
   3:         62256        4727832  [C
   4:         19665        3124744  <constMethodKlass>
   5:         19665        2365864  <methodKlass>
   6:         57843        2313720  java.lang.String
   7:          1662        2060528  <constantPoolKlass>
   8:         21121        1842344  [S
   9:         37772        1743888  <symbolKlass>
  10:          2554        1655632  [I
  11:         63710        1529040  java.lang.Integer
  12:          1662        1264184  <instanceKlassKlass>
  13:          1515        1196224  <constantPoolCacheKlass>
  14:         24351        1168848  java.util.HashMap$Entry
  15:         18706        1047536  java.net.SocketTimeoutException
  16:          4301         784416  [B
 ...
  23:          2588         242616  [[I
like image 303
Chris Steinbach Avatar asked Oct 27 '11 09:10

Chris Steinbach


People also ask

What is JMAP histo?

Depending on the parameter specified, the jmap -histo command can print out the heap histogram for a running process or a core file. When the command is executed on a running process, the tool prints the number of objects, memory size in bytes, and fully qualified class name for each class.

What does JMAP do?

jmap is a tool to print statistics about memory in a running JVM. We can use it for local or remote processes. Along with that option, we should specify several parameters: live: if set, it only prints objects which have active references and discards the ones that are ready to be garbage collected.

How use JMAP command in Linux?

jmap tool is shipped with JDK. Here is how you should invoke it: jmap -dump:live,file=<file-path> <pid> where pid: is the Java Process Id, whose heap dump should be captured file-path: is the file path where heap dump will be written in to. Note: It's quite important that you pass the “live” option in the command line.


1 Answers

  • [C is a char[]
  • [S is a short[]
  • [I is a int[]
  • [B is a byte[]
  • [[I is a int[][]

The JavaDoc for Class.getName() has the details.

like image 139
Joachim Sauer Avatar answered Oct 16 '22 14:10

Joachim Sauer