After JDK 1.2 beta 3 shipped, we discovered that the binary heap profile files that are written out under Win32 are corrupt. This is described in more detail in the JDC Bug Parade under bug number 4124489.
Fortunately, a workaround is possible! Just download this program. Before running the program you want to debug, start it in another window with a command like this:
java Win32Workaround dump.hprof 7000
This starts the Win32Workaround program listening on port 7000. Then, invoke the program you want to debug with a command like this:
java -Xhprof:net=localhost:7000,format=b MyProgram
This instructs the JavaTM Runtime to write the heap profile to socket 7000 on the machine "localhost". On some systems, it might be necessary to use 127.0.0.1 instead of localhost.
When the program being debugged terminates, Win32Workaround should also terminate. It will have written out the .hprof file specified on the command line. You can use this file with hat in the normal way.
The Win32 bugs in JDK 1.2beta3 are well-understood, so they should be fixed in 1.2beta4. The Win32Workaround can only read the malformed output produced by 1.2beta3; if it is run with a runtime that produces a correctly-formatted file, it might corrupt it.