1

I run jmap on my JVM to try to understand some memory leaks and I discovered something strange : the java.lang.Long use 24 bytes instead of 8 !!!

Can some tell me where is my mistake ?

 num     #instances         #bytes  class name
----------------------------------------------
   1:      11043837      530104176  java.util.HashMap$Entry
   2:      15788616      378926784  java.lang.Long
   3:       2933013      301617976  [C


#bytes / #instance => 378926784 / 15788616  => 24 bytes

WTF ????

Ektor
  • 163
  • 1
  • 7

1 Answers1

0

OK, I had to refresh my knowledge about java memory usage.

8 bytes is for a long primitive type.

For an object (as java.lang.Long), there is an overhead of 8 bytes for the header. Now; I've solved half of the problem but 8 bytes still missing...

Ektor
  • 163
  • 1
  • 7