Skip to content
Advertisement

jhat throwing unrecognized magic number

I am trying to analyse a heap dump taken from a java process that ran into memory issues. The dump was taken using jmap. I am using jhat on the dump file – I am getting

java.io.IOException: Unrecognized magic number: 169897589 at com.sun.tools.hat.internal.parser.Reader.readFile(Reader.java:94) at com.sun.tools.hat.Main.main(Main.java:159)

Both jdk 1.6 and 1.7 give the same error. I am running the jhat on my Windows machine locally (after copying the dump file over ) and the dump file was taken on Linux server.

Any ideas what I am doing wrong ?

Advertisement

Answer

If you take a look at the source code for com.sun.tools.hat.internal.parser.Reader, you’ll see that it’s looking for the magic number 0x4a415641.

This value is used to help identify valid heap dump files. jmap should append this value as the first four bytes of any heap dump file it creates.

I’d suggest opening up your heap dump in a hex editor and checking to see whether the first four bytes are 0x4a415641. Check this for the file on both your Linux and Windows machine. Perhaps the file is getting corrupted when you transfer the file.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement