public static class BTraceUtils.Sys.Memory
extends java.lang.Object
Constructor and Description |
---|
Memory() |
Modifier and Type | Method and Description |
---|---|
static long |
committed(java.lang.management.MemoryUsage mu)
Returns the amount of memory in bytes that is committed for the Java
virtual machine to use.
|
static void |
dumpHeap(java.lang.String fileName)
Dump the snapshot of the Java heap to a file in hprof
binary format.
|
static void |
dumpHeap(java.lang.String fileName,
boolean live)
Dump the snapshot of the Java heap to a file in hprof
binary format.
|
static long |
finalizationCount()
Returns the approximate number of objects for
which finalization is pending.
|
static long |
freeMemory()
Returns the amount of free memory in the Java Virtual Machine.
|
static void |
gc()
Runs the garbage collector.
|
static java.lang.String |
getMemoryPoolUsage(java.lang.String poolFormat)
Returns an overview of available memory pools
It is possible to provide a text format the overview will use |
static long |
getTotalGcTime()
Returns the total amount of time spent in GarbageCollection up to this point
since the application was started.
|
static java.lang.management.MemoryUsage |
heapUsage()
Returns heap memory usage
|
static long |
init(java.lang.management.MemoryUsage mu)
Returns the amount of memory in bytes that the Java virtual
machine initially requests from the operating system for
memory management.
|
static long |
max(java.lang.management.MemoryUsage mu)
Returns the maximum amount of memory in bytes that can be used
for memory management.
|
static long |
maxMemory()
Returns the maximum amount of memory that the Java virtual machine will
attempt to use.
|
static java.lang.management.MemoryUsage |
nonHeapUsage()
Returns non-heap memory usage
|
static void |
runFinalization()
Runs the finalization methods of any objects pending finalization.
|
static long |
totalMemory()
Returns the total amount of memory in the Java virtual machine.
|
static long |
used(java.lang.management.MemoryUsage mu)
Returns the amount of used memory in bytes.
|
public static long freeMemory()
gc
method may result in increasing the value returned
by freeMemory.
public static long totalMemory()
Note that the amount of memory required to hold an object of any given type may be implementation-dependent.
public static long maxMemory()
Long.MAX_VALUE
will be returned. public static java.lang.management.MemoryUsage heapUsage()
public static java.lang.management.MemoryUsage nonHeapUsage()
public static long init(java.lang.management.MemoryUsage mu)
public static long committed(java.lang.management.MemoryUsage mu)
public static long max(java.lang.management.MemoryUsage mu)
public static long used(java.lang.management.MemoryUsage mu)
public static long finalizationCount()
public static void dumpHeap(java.lang.String fileName)
fileName
- name of the file to which heap is dumpedpublic static void dumpHeap(java.lang.String fileName, boolean live)
fileName
- name of the file to which heap is dumpedlive
- flag that tells whether only live objects are
to be dumped or all objects are to be dumped.public static void gc()
Calling the gc
method suggests that the Java Virtual
Machine expend effort toward recycling unused objects in order to
make the memory they currently occupy available for quick reuse.
When control returns from the method call, the Java Virtual
Machine has made a best effort to reclaim space from all discarded
objects. This method calls Sys.gc() to perform GC.
public static long getTotalGcTime()
public static java.lang.String getMemoryPoolUsage(java.lang.String poolFormat)
poolFormat
- The text format string to format the overview. public static void runFinalization()
Calling this method suggests that the Java Virtual Machine expend
effort toward running the finalize
methods of objects
that have been found to be discarded but whose finalize
methods have not yet been run. When control returns from the
method call, the Java Virtual Machine has made a best effort to
complete all outstanding finalizations. This method calls
Sys.runFinalization() to run finalization.