Loading a large hprof into jhat

28,004

Solution 1

I would take a look at the eclipse memory analyzer. This tool is great, and I have looked at several Gig heaps w/ this tool. The nice thing about the tool is it creates indexes on the dump so it is not all in memory at once.

Solution 2

Use the equivalent of jhat -J-d64 -J-mx16g myheap.hprof as a command to launch jhat, i.e., this will start jhat in 64-bit mode with a maximum heap size of 16 gigabytes.

If the JVM on your platform defaults to 64-bit-mode operation, then the -J-d64 option should be unnecessary.

Solution 3

I had to load a 11 GB hprof file and couldn't with eclipse memory analyzer. What I ended up doing was to write a program to reduce the size of the hprof file by randomly removing instance information. Once I got the size of the hprof file down to 1GB, I could open it with eclipse memory analyzer and get a clue on what was causing the memory leak.

Share:
28,004

Related videos on Youtube

liam
Author by

liam

Not much.

Updated on July 09, 2022

Comments

  • liam
    liam almost 2 years

    I have a 6.5GB Hprof file that was dumped by a 64-bit JVM using the -XX:-HeapDumpOnOutOfMemoryError option. I have it sitting on a 16GB 64-bit machine, and am trying to get it into jhat, but it keeps running out of memory. I have tried passing in jvm args for minimum settings, but it rejects any minimum, and seems to run out of memory before hitting the maximum.

    It seems kind of silly that a jvm running out of memory dumps a heap so large that it can't be loaded on a box with twice as much ram. Are there any ways of getting this running, or possibly amortizing the analysis?

  • liam
    liam over 14 years
    This worked. I actually tried it before with some smaller heap dumps and it really didn't give me any helpful info, but once i got it in with the HeapDumpOnOutOfMemoryError hprof it finally pointed out the exact problem.
  • BeeOnRope
    BeeOnRope over 10 years
    Care to share the tool or details how how to write a similar one?
  • rogerdpack
    rogerdpack about 9 years
    Unfortunately MAT still used quite a lot of RAM for me ["failure java heap space"], see stackoverflow.com/questions/7254017/…