Fully featured low overhead profiler for Java EE and Java SE platforms.
Easy to use performance and memory .NET profiler for Windows and Linux.
Performance monitoring and profiling of Jenkins, Bamboo, TeamCity, Gradle, Maven, Ant and JUnit.

Out of memory error (OutOfMemoryError and -XX:+HeapDumpOnOutOfMemoryError)

A memory snapshot is captured automatically on first OutOfMemoryError, if the profiled application runs on Oracle JDK or OpenJDK HotSpot.

On OutOfMemoryError snapshots are captured via JVM's built-in dumper, which for some reason is disabled by default. JVM option -XX:+HeapDumpOnOutOfMemoryError enables it.

However, you do not need to specify this option when profiling applications because the profiler agent programmatically enables the dumper upon profiled application startup or when the agent is attached to a running application.

Enabling the dumper adds absolutely no overhead. Technically, enabling is simply setting the state of a boolean flag. When the first OutOfMemoryError occurs, the JVM dumps the heap to file if the flag is "true".

Anyway, if for some reason you want not to enable the dumper, specify startup option disableoomedumper.

To check the status, connect to the profiled application and hover over corresponding button as shown on the picture below:

The profiler shows the following notification when a snapshot is captured on OutOfMemoryError.

Please note that this approach has several benefits over the capturing snapshot on high memory usage feature, because it uses the JVM's internal lightweight dumping algorithm. This algorithm is specially designed to work in low memory conditions, where the JVM general purpose profiling interface JVMTI used by profilers may fail due to low resources.

See also Support of HPROF format snapshots.

YourKit uses cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content and targeted ads, to analyze our website traffic, and to understand where our visitors are coming from.

By browsing our website, you consent to our use of cookies and other tracking technologies in accordance with the Privacy Policy.