Search code examples
javamemory-leaksheap-memorydump

Heap dump on JRE 6 (Windows) without JDK


Is there a way to create a heap dump on a remote machine without JDK installed?

I can't change the installation / settings and it's running on Windows. So I have pnly access to commandline tools.

Problem is that a Java app on a remote machine freezes (no out of memory exception so -XX:-HeapDumpOnOutOfMemoryError is useless) and we need to create a dump.

-XX:+HeapDumpOnCtrlBreak 

is no option too, because it's not supported anymore on JDK6+.

JMX is not allowed due to security reasons.

Any Ideas? Thank you for your help!

Edit:

  • Windows
  • No JDK
  • No JMX

Solution

  • I think I solved the problem.

    You have to "patch" your JRE with some files of the JDK (the same version of course - if you are running jre6uXX you need the corresponding files from jdk6uXX )

    Copy the following files:

    • \JDK6uXX\bin\attach.dll --> %JAVAJRE_HOME%\bin\
    • \JDK6uXX\bin\jmap.exe --> %JAVAJRE_HOME%\bin\
    • \JDK6uXX\lib\tools.jar --> %JAVAJRE_HOME%\lib\

    No files are overwritten, JRE shouldn't be affected by this.

    Now you can use jmap just fine to take dumps ;-)

    I appreciate your help! Bye