- Running the profiler
- Profiler activation
- Running applications with the profiler
- Connect to profiled application
- Troubleshoot connection problems
- Solving performance problems
- Performance bottlenecks
- Optimizing memory usage
- Memory leaks
- Excessive garbage allocation
- Out of memory error (OutOfMemoryError and -XX:+HeapDumpOnOutOfMemoryError)
- CPU profiling
- Deadlock detector
- Memory profiling
- Garbage collection
- Monitor profiling
- Exception profiling
- Probes: monitor events of various kinds
- Performance Charts
- Inspections: automatic recognition of typical problems
- Automatically trigger actions on event
- Summary, snapshot annotation, automatic deobfuscation
- IDE integration
- Time measurement (CPU time, wall time)
- Snapshot directory customization
- Export of profiling results to HTML, CSV, XML, plain text
- Profiler API
- Command line tool to control profiling
- FAQ: How to profile in my scenario?
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
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.