Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java VisualVM Enable Heap Dump on OOME

According to documentation one could automatically take a heap dump when the application encounters an OutOfMemoryException.
After OutOfMemoryException process just disappear from left menu.
How does this feature works in VisualVM?

Thanks.


C:\work\temp>java -XX:HeapDumpPath=c:/work/temp/file.hprof -XX:+HeapDumpOnOutOfMemoryError -jar example.jar

like image 245
Mike Avatar asked Nov 29 '11 13:11

Mike


1 Answers

As far as I know, that option in JVisualVM is equivalent to specifying -XX:+HeapDumpOnOutOfMemoryError as a JVM parameter. This causes the JVM to create a heap dump file when it encounters an OutOfMemoryError. This file can be then loaded into JVisualVM (or into a profiler) and analyzed there. The directory where the file is stored is defined by the -XX:HeapDumpPath parameter.

See also:

  • Troubleshooting Guide for Java SE 6 with HotSpot VM
  • Java HotSpot VM Options
  • StackOverflow: Using HeapDumpOnOutOfMemoryError parameter
like image 200
Eli Acherkan Avatar answered Oct 15 '22 08:10

Eli Acherkan