I know one can dump a .dmp file from a C++ project. This dmp file can be openned by the Visual Studio which is VERY useful because then you can navigate the call stack looking in variables values.
Does this mechanism exist for JVM too?
I know one can dump a .dmp file from a C++ project. This dmp file can be openned by the Visual Studio which is VERY useful because then you can navigate the call stack looking in variables values.
Does this mechanism exist for JVM too?
You can use -XX:HeapDump
JVM options.
With the following JVM options:
-XX:-HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath="/tmp"
JVM will dump the content of heap to a file in specified directory. Note that this only happens when OutOfMemoryError
is thrown since dump isn't really needed if JVM crashed due to a different reason.
You may also want to read http://docs.oracle.com/javase/6/docs/technotes/tools/share/jhat.html once
You can use jmap whenever you want to get a JVM dump.
jmap -dump:format=b,file=/path/to/store/dumpfile jvmpid
You can add JVM option at startup to get a JVM dump when OOM.
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/store/dumpfile
The Eclipse Memory Analyzer is a fast and feature-rich Java heap analyzer that helps you find memory leaks and reduce memory consumption.
2.Use IBM HeapAnalyzer
HeapAnalyzer allows the finding of a possible Java™ heap leak area through its heuristic search engine and analysis of the Java heap dump in Java applications.
You can remote debug (e.g. with Eclipse) your Java application which allows you to view the stack and the variable contents.
Or you could take a Thread dump (e.g. with jstack). But this does not include the variables.