getMemoryUsage Method

Description

Returns the usage state of the Explicit heap.

Format

public static java.lang.management.MemoryUsage getMemoryUsage();

Parameters

None

Exceptions

None

Return value

This method returns the reference to the java.lang.management.MemoryUsage instance that maintains the usage state of the Explicit heap as a field, in the form of the following values:

init:
This is the initial value of the Explicit heap. This value is always 0.
used:
This is the memory size (number of bytes) being used in the Explicit heap.
committed:
This is the reserved size (number of bytes) of the Explicit heap.
max:
This is the value (number of bytes) of the maximum Explicit heap size specified by -XX:HitachiExplicitHeapMaxSize. However, when the option HitachiUseExplicitMemory is OFF (when -XX:+HitachiUseExplicitMemory is specified), 0 is returned.

Caution

The value contained in the MemoryUsage instance is the value at the point of time when getMemoryUsage() is invoked. This value might be different from the actual value when each field is read out from the MemoryUsage instance.