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 ?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With