public class HeapDumper
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
dumpHeap()
Dumps live objects from the heap to the outputFile file in the same format as the hprof heap dump.
|
static java.lang.String |
dumpHeap(boolean live)
Dumps objects from the heap to the outputFile file in the same format as the hprof heap dump.
|
static java.lang.String |
dumpHeap(java.io.File basedir,
boolean live)
Dumps objects from the heap to the outputFile file in the same format as the hprof heap dump.
|
static void |
dumpHeap(java.lang.String fileName)
Dumps live objects from the heap to the outputFile file in the same format as the hprof heap dump.
|
static void |
dumpHeap(java.lang.String fileName,
boolean live)
Dumps the heap to the outputFile file in the same format as the hprof heap dump.
|
static void |
init()
Initialise the dumper, and report if there is a problem.
|
public static void init() throws java.lang.Exception
java.lang.Exception
- if there is a problem finding the heapDump MXBeanpublic static void dumpHeap(java.lang.String fileName, boolean live) throws java.lang.Exception
Calls the dumpHeap() method of the HotSpotDiagnostic MXBean, if available.
fileName
- name of the heap dump file. Must be creatable, i.e. must not exist.live
- if true, dump only the live objectsjava.lang.Exception
- if the MXBean cannot be found, or if there is a problem during invocationpublic static void dumpHeap(java.lang.String fileName) throws java.lang.Exception
fileName
- name of the heap dump file. Must be creatable, i.e. must not exist.java.lang.Exception
- if the MXBean cannot be found, or if there is a problem during invocationdumpHeap(String, boolean)
public static java.lang.String dumpHeap() throws java.lang.Exception
Creates the dump using the file name: dump_yyyyMMdd_hhmmss_SSS.hprof The dump is created in the current directory.
java.lang.Exception
- if the MXBean cannot be found, or if there is a problem during invocationdumpHeap(boolean)
public static java.lang.String dumpHeap(boolean live) throws java.lang.Exception
Creates the dump using the file name: dump_yyyyMMdd_hhmmss_SSS.hprof The dump is created in the current directory.
live
- true id only live objects are to be dumped.java.lang.Exception
- if the MXBean cannot be found, or if there is a problem during invocationdumpHeap(String, boolean)
public static java.lang.String dumpHeap(java.io.File basedir, boolean live) throws java.lang.Exception
Creates the dump using the file name: dump_yyyyMMdd_hhmmss_SSS.hprof
basedir
- File object for the target base directory.live
- true id only live objects are to be dumped.java.lang.Exception
- if the MXBean cannot be found, or if there is a problem during invocationdumpHeap(String, boolean)
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.