Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enable HeapDumpOnOutOfMemoryError in runtime

Tags:

java

jconsole

according to http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/clopts.html it should be possible to enable -XX:+HeapDumpOnOutOfMemoryError using JConsole in runtime. How?

I assume its somewhere under MBeans tab and the com.sun.management -> HotSpotDiagnostic -> Operations -> setVMOptions ?

like image 347
Schildmeijer Avatar asked Sep 07 '09 13:09

Schildmeijer


People also ask

What is HeapDumpOnOutOfMemoryError?

The -XX:+HeapDumpOnOutOfMemoryError command-line option tells the HotSpot VM to generate a heap dump when an allocation from the Java heap or the permanent generation cannot be satisfied.

How do you get heap dump on OutOfMemoryError?

In order to capture a heap dump automatically, we need to add the HeapDumpOnOutOfMemoryError command-line option that generates a heap dump when a java. lang. OutOfMemoryError is thrown.

Where is Java heap dump?

By default the heap dump is created in a file called java_pidpid. hprof in the working directory of the VM, as in the example above. You can specify an alternative file name or directory with the -XX:HeapDumpPath= option.

Where is heap dump file located?

The JDK comes with several tools to capture heap dumps in different ways. All these tools are located under the bin folder inside the JDK home directory.


1 Answers

Yes, you have to use the setVMOption with "HeapDumpOnOutOfMemoryError" as p0 and "true" as p1 parameter according to the Monitoring and Managing Java SE 6 Platform Applications.

like image 189
Csaba_H Avatar answered Oct 07 '22 06:10

Csaba_H