I want my java to exit when catching OutOfMemoryError, I'm using the -XX:+HeapDumpOnOutOfMemoryError to dump hprof file.
I can't use kill -9 <pid> because the JVM needs to be up while dumping the hprof file, is there any way to stop the JVM after the hprof file created?
To be clear I'm using Sun's JVM version 6.
This page seems to imply that you can combine -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError="kill -9 %p"
Presumably, the heap dump is created before the "On..." command is run. (It should be easy to throw together something to test this out.)
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