0

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).

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

I did extensive research and it seems like the method you mentioned is actually the only way to achieve this on an Oracle JVM. It was kind of disappointing for me to find that out because achieving the same thing using an IBM JVM is much simpler where you simply add a parameter and modifying it depending on the event and type of dump you need (Java, heap or system core). I haven't coded in C/C++ in ages, this is going to be a daunting task :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.