public final class MemoryInfo
extends java.lang.Object
This class uses terminology described in the following:
| Modifier and Type | Class and Description |
|---|---|
static class |
MemoryInfo.MaxDirectMemoryInfo
Details of a max direct memory specification.
|
| Modifier and Type | Method and Description |
|---|---|
long |
configuredMaxDirectMemory()
Gets the amount of direct, off-heap memory specified using the
MaxDirectMemorySize JVM option. |
MemoryInfo.MaxDirectMemoryInfo |
configuredMaxDirectMemoryInfo()
Gets the
MemoryInfo.MaxDirectMemoryInfo instance describing the max direct memory value specified by
JVM option. |
long |
directBufferCount()
Gets the number of directly allocated off-heap buffers.
|
long |
directMemoryInUse()
Gets the amount of off-heap memory in use for direct
ByteBuffers. |
long |
effectiveMaxDirectMemory()
Gets the maximum amount of direct, off-heap memory that can be used in this JVM.
|
MemoryInfo.MaxDirectMemoryInfo |
effectiveMaxDirectMemoryInfo()
Gets the
MemoryInfo.MaxDirectMemoryInfo instance describing maximum amount of direct, off-heap memory
that can be used in this JVM. |
static java.lang.String |
formatSize(long size)
Formats a
long memory byte-size value into a human-readable memory size. |
static MemoryInfo |
getInstance()
Gets the singleton
MemoryInfo instance. |
long |
heapInUse()
Gets the total heap memory currently in use across all heap memory pools.
|
long |
mappedBufferCount()
Gets the number of off-heap buffers used for mapped file buffers.
|
long |
mappedMemoryInUse()
Gets the amount of off-heap memory in use for mapped
ByteBuffers. |
java.util.List<java.lang.management.MemoryPoolMXBean> |
memoryPoolMXBeans()
Gets the list of
MemoryPoolMXBean instances. |
long |
offHeapBufferCount()
Gets the number of all off-heap memory buffers in use.
|
long |
offHeapMemoryInUse()
Gets the amount of off-heap memory in use.
|
public static MemoryInfo getInstance()
MemoryInfo instance.MemoryInfo instancepublic long effectiveMaxDirectMemory()
If the returned value is -1, the effectiveMaxDirectMemoryInfo() method may be used
to obtain additional detail.
MaxDirectMemorySize JVM option or the default calculated during JVM initialization;
a value of -1 is returned if the max direct memory is unavailableeffectiveMaxDirectMemoryInfo()public MemoryInfo.MaxDirectMemoryInfo effectiveMaxDirectMemoryInfo()
MemoryInfo.MaxDirectMemoryInfo instance describing maximum amount of direct, off-heap memory
that can be used in this JVM.MaxDirectMemoryInfo instance for direct, off-heap memorypublic long configuredMaxDirectMemory()
MaxDirectMemorySize JVM option.
If the returned value is -1, the configuredMaxDirectMemoryInfo() method may be used
to obtain additional detail.
MaxDirectMemorySIze option;
a value of -1 is returned if the MaxDirectMemorySize option was not specified
or if the specified value could was not understoodconfiguredMaxDirectMemoryInfo()public MemoryInfo.MaxDirectMemoryInfo configuredMaxDirectMemoryInfo()
MemoryInfo.MaxDirectMemoryInfo instance describing the max direct memory value specified by
JVM option.MaxDirectMemoryInfo instance describing the max direct, off-heap memory as
configured by JVM optionpublic java.util.List<java.lang.management.MemoryPoolMXBean> memoryPoolMXBeans()
MemoryPoolMXBean instances.MemoryPoolMXBean instancespublic long heapInUse()
public long offHeapMemoryInUse()
direct
and mapped and possibly other types depending on the JVM.public long offHeapBufferCount()
direct
and mapped and possibly other types depending on the JVM.public long directMemoryInUse()
ByteBuffers.public long directBufferCount()
public long mappedMemoryInUse()
ByteBuffers.public long mappedBufferCount()
public static java.lang.String formatSize(long size)
long memory byte-size value into a human-readable memory size.size - the memory size, in bytes, to format