heapdump size vs hprof size

Michael picture Michael · Jul 26, 2012 · Viewed 13.3k times · Source

I recently made a heapdump in a hprof format when my jboss server was running with a xms of 4096m and xmx of 4096m and a permsize of 512m.

The hprof file generated is over 5gb. When I load the heapdump in visualvm, mat analyzer or yourkit, I only see a total bytes of approximately 1gb. I've tried changed the reachability scope in yourkit but it does not show more than 1 gb.

Any idea what this big difference in filesize vs displayed heapdump size can cause?

ps: I'm using jdk1.6.0_23

Unfortunately I'm not allowed to submit screenshots here.

On the filesystem the hprof size is of 5.227.659 kb and in yourkit it states:

Objects: 9.738.282 / shallow size 740 mb / retained size: 740 mb String reachable among them: 6.652.515 (68%) / shallow size: 381 mb (51%) / retained size: 381 MB (51%)

The largest retained size is a byte[] of 206.810.176

Answer

Andrey Borisov picture Andrey Borisov · Jul 26, 2012

which command did you use to generate heap dump?

$JAVA_HOME/bin/jmap -dump:live,format=b,file=c:/tmp/heap_dump.bin PID

maybe you need to pass live option, according to spec

 -dump:<dump-options> to dump java heap in hprof binary format
                   dump-options:
                     live         dump only live objects; if not specified,
                                  all objects in the heap are dumped.