Dump heap on JRE 6 (Windows) without JDK

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

I cannot change the installation / settings and work on Windows. Therefore I have easy access to command line tools.

The problem is that the Java application on the remote machine hangs (out of memory exception, so -XX: -HeapDumpOnOutOfMemoryError is useless) and we need to create a dump.



also not an option as it is no longer supported on JDK6 +.

JMX is prohibited for security reasons.

Any ideas? Thanks for the help!


  • for windows
  • No JDK
  • No JMX

source to share

6 answers

I think I solved the problem.

You need to "fix" your JRE with some JDK files (in the same version, of course, if you are using 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, the JRE should not be affected by this.

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

I appreciate your help! Bye



The simplest solution is to use jmap -dump:liv,format=b,file=app.dump

on the command line. You can use jps -lvm

to find the process id.

The alternative is to connect to it jvisualvm

. This will dump and parse it for you. You can also use this tool to read the dump written by jmap so you can use it anyway.

Where is the jvisualvm

fight for big heap heaps, i.e. more than half of your main memory. I found using YourKit to handle large dumps and also provide more helpful information. An evaluation license may be all you need to diagnose this.

jmx is not allowed due to security reasons

In this case, you will not be able to do it remotely if you do not use YourKit

or some other advertising profiler.



You run your application with jmx console included in port to debug your application. Execute jconsole and connect to the port you enabled for debugging. You can also use jmap to collect the heapdump.



JProfiler has a command line utility bin/jpdump

that can take an HPROF heap dump. No need to install JDK. There is also no need to run the JProfiler GUI installer, just extract the ZIP distribution and jpdump on the command line.

Disclaimer: My company is developing JProfiler.

Update 2016-06-23

Like JProfiler 9.2, jpdump and jpenable work with Java 6.



You can use jvisualvm, just enable the jmx port and connect to your application, then you can generate the heap file.

You can do this by adding the following parameters:



Then you need to add the tomcat process manually, for So right click on you localhost node -> Add JMX Connection -> type your port -> OK


Your tomcat process will be listed under the localhost node.



     jmap -dump:format=b,file=snapshot.jmap  


Regardless of how the Java virtual machine was started, the jmap tool will create a snapshot of the head dump in the above example in the snapshot.jmap file. Jmap output files should contain all primitive data, but will not contain stack traces showing where the objects were created.



All Articles