The documentation at [http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/memleaks.html#gbywi|http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/memleaks.html#gbywi] contains the following sentence:
+"If you specify the -XX:+HeapDumpOnOutOfMemoryError command-line option, and if an OutOfMemoryError is thrown, the VM generates a heap dump. You can then use the jmap utility to obtain a histogram from the heap dump."+
I have a .hprof heap dump file (my system ran out of memory, and dumped its heap), but I see no way to use jmap to create a histogram from it. Is this sentence wrong, or am I just missing something? I can see options to do stuff from core files, but not heap dump files.
I am trying to use jhat to get a histogram, but the heap is around 4Gb, and although jhat managed to load the file (when I gave it 23Gb of memory), it seems to be taking forever to display the histogram.
Alternatively, does anyone know of any other ways to get a histogram from a heap dump file?
there is no way to get the histogram from the heap dump using jmap. Jmap can produce histogram from live process or from core dump. To browse the heap dump you can use Java VisualVM (part of JDK 1.6.0 update 7 or newer) or standalone VisualVM available at visualvm.dev.java.net