Java binary heap dumps can be created using
jmap -dump:format=b,file=heap.bin <pid-of-java-process>
Recall that jhat (Java Heap Analysis Tool) supports webbrowser based interface.
jhat parses a heap binary file and starts a webserver. Then, we'd use a webbrowser to query the heap. With this new Swing based tool for heap dumps, it is easier to work with heap dumps. I used the following commands to create and view a heap dump using jhat swing interface:
D:\\jdk1.6.0\\demo\\jfc\\Java2D>jmap -dump:format=b,file=heap.bin 1204
Dumping heap to D:\\jdk1.6.0\\demo\\jfc\\Java2D\\heap.bin ...
Heap dump file created
D:\\jdk1.6.0\\demo\\jfc\\Java2D>java -Xmx256m -classpath D:\\jdk1.6.0\\lib\\tools.jar;S
wingJHAT.jar org.netbeans.profiling.tools.SwingJHAT heap.bin
Dump file created Wed Oct 04 19:16:13 GMT+05:30 2006
Resolving 54815 objects...
Chasing references, expect 10 dots..........
Eliminating duplicate references..........
Note: classes in tools.jar may be changed without notice. Not all classes in tools.jar are part of platform interface. Such non-public classes may be renamed or removed in next release!
If you have ideas on improving heap dumps, like different/better file format and/or what needs to be included in heap dumps and so on, then please join and contribute to the heap snapshot project.