Package se.jiderhamn
Class HeapDumper
java.lang.Object
se.jiderhamn.HeapDumper
Class that helps programatically dumping the heap.
Heavily inspired by https://blogs.oracle.com/sundararajan/entry/programmatically_dumping_heap_from_java
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Dump the heap snapshot into a file.private static com.sun.management.HotSpotDiagnosticMXBean
Get HotSpot diagnostic MBean
-
Field Details
-
HOTSPOT_BEAN_NAME
The name of the HotSpot Diagnostic MBean- See Also:
-
HEAP_DUMP_EXTENSION
Filename extension for heap dumps- See Also:
-
hotSpotDiagnosticMBean
private static volatile com.sun.management.HotSpotDiagnosticMXBean hotSpotDiagnosticMBeanHotSpot diagnostic MBean
-
-
Constructor Details
-
HeapDumper
public HeapDumper()
-
-
Method Details
-
dumpHeap
Dump the heap snapshot into a file.- Parameters:
file
- The file in which the dump will be storedlive
- Dump only live objects?- Throws:
ClassNotFoundException
-
getHotSpotDiagnosticMBean
private static com.sun.management.HotSpotDiagnosticMXBean getHotSpotDiagnosticMBean()Get HotSpot diagnostic MBean
-