Class HeapDumper

java.lang.Object
org.springframework.integration.test.util.HeapDumper

public class HeapDumper
extends Object
Use to take a heap dump programmatically. Useful to examine the heap when debugging sporadic test failures.

Commented out because it uses access-restricted classes and some IDEs won't build the project without relaxing the access restriction.

Usage: HeapDumper.dumpHeap("/tmp/foo.hprof");

If the file exists already, it will be replaced.

Courtesy: https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java

 See https://docs.oracle.com/javase/8/docs/jre/api/management/extension/com/sun/management/HotSpotDiagnosticMXBean.html#dumpHeap-java.lang.String-boolean-
 
Since:
4.2
Author:
Gary Russell