Reputation: 346
I worked mainly with the IBM SDK so there is a specific JVM argument you can use in order to enable dumps (heap, thread, system core) on specific events or exceptions (java.lang.OutOfMemoryError, SIGTERM, etc...)
I want to be able to do the same thing using the Oracle JDK. I only see the argument: -XX:+HeapDumpOnOutOfMemoryError which will only generate a heap dump for the specific exception java.lang.OutOfMemoryError.
Basically I do not have access to the code, so I want to be able to have the JVM generate both a heap dump and a Java thread dump for analysis (java.lang.OutOfMemoryError is one of many other events).
Upvotes: 0
Views: 1845
Reputation: 98610
JVM Tool Interface is a standard way to implement such tools.
JVMTI Agents can set up callbacks for a variety of events.
Here are some examples how to handle exceptions events and how to dump heap before VM exit.
Upvotes: 3