Package se.jiderhamn
Class HeapDumper
- java.lang.Object
-
- se.jiderhamn.HeapDumper
-
public class HeapDumper extends java.lang.Object
Class that helps programatically dumping the heap. Heavily inspired by https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HEAP_DUMP_EXTENSION
Filename extension for heap dumpsprivate static java.lang.String
HOTSPOT_BEAN_NAME
The name of the HotSpot Diagnostic MBeanprivate static com.sun.management.HotSpotDiagnosticMXBean
hotSpotDiagnosticMBean
HotSpot diagnostic MBean
-
Constructor Summary
Constructors Constructor Description HeapDumper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
dumpHeap(java.io.File file, boolean live)
Dump the heap snapshot into a file.private static com.sun.management.HotSpotDiagnosticMXBean
getHotSpotDiagnosticMBean()
Get HotSpot diagnostic MBean
-
-
-
Field Detail
-
HOTSPOT_BEAN_NAME
private static final java.lang.String HOTSPOT_BEAN_NAME
The name of the HotSpot Diagnostic MBean- See Also:
- Constant Field Values
-
HEAP_DUMP_EXTENSION
public static final java.lang.String HEAP_DUMP_EXTENSION
Filename extension for heap dumps- See Also:
- Constant Field Values
-
hotSpotDiagnosticMBean
private static volatile com.sun.management.HotSpotDiagnosticMXBean hotSpotDiagnosticMBean
HotSpot diagnostic MBean
-
-
Method Detail
-
dumpHeap
public static void dumpHeap(java.io.File file, boolean live) throws java.lang.ClassNotFoundException
Dump the heap snapshot into a file.- Parameters:
file
- The file in which the dump will be storedlive
- Dump only live objects?- Throws:
java.lang.ClassNotFoundException
-
getHotSpotDiagnosticMBean
private static com.sun.management.HotSpotDiagnosticMXBean getHotSpotDiagnosticMBean()
Get HotSpot diagnostic MBean
-
-