Interface MemoryPoolMXBean
- All Superinterfaces:
MemoryPoolMXBean, PlatformManagedObject
The OpenJ9 interface for managing and monitoring the virtual machine's memory pools.
The following list describes 4 common behavior changes for 1. More detailed heap memory pools can be obtained by calling
The following names are reported for heap memory pools, listed by garbage collection policy:
For -Xgcpolicy:gencon
For -Xgcpolicy:optthruput and -Xgcpolicy:optavgpause
For -Xgcpolicy:balanced
For -Xgcpolicy:metronome
3. Usage Threshold (
The usage threshold attribute is designed for monitoring the increasing trend of memory usage and incurs only a low overhead.
This attribute is not appropriate for some memory pools.
Use the
The following names are reported for heap memory pools that support the usage threshold attribute:4. Collection Usage Threshold (
The collection usage threshold is a manageable attribute that is applicable only to some garbage-collected memory pools.
This attribute reports the amount of memory taken up by objects that are still in use after a garbage collection cycle.
Use the
The following names are reported for heap memory pools that support the collection usage threshold attribute:
MemoryPoolMXBean.
You can revert to the earlier implementation of MemoryPoolMXBean by setting the
-XX:+HeapManagementMXBeanCompatibility Java command line option.
1. More detailed heap memory pools can be obtained by calling ManagementFactory.getMemoryPoolMXBeans()
The following names are reported for heap memory pools, listed by garbage collection policy:
For -Xgcpolicy:gencon
- nursery-allocate
- nursery-survivor
- tenured-LOA
- tenured-SOA
For -Xgcpolicy:optthruput and -Xgcpolicy:optavgpause
- tenured-LOA
- tenured-SOA
For -Xgcpolicy:balanced
- balanced-reserved
- balanced-eden
- balanced-survivor
- balanced-old
For -Xgcpolicy:metronome
- JavaHeap
If you set the -XX:+HeapManagementMXBeanCompatibility option to turn on compatibility with earlier versions of the VM,
information about heap memory pools is reported in the older format.
The following name is reported for the heap memory pool for all garbage collection policies in the old format:
- Java heap
2. Memory Usage
Memory usage for each heap memory pool can be retrieved by usingMemoryPoolMXBean.getUsage() or MemoryPoolMXBean.getCollectionUsage().
In some cases the total sum of memory usage of all heap memory pools is more than the maximum heap size.
This irregularity can be caused if data for each pool is collected between garbage collection cycles,
where objects have been moved or reclaimed.
If you want to collect memory usage data that is synchronized across the memory pools, use the
GarbageCollectionNotificationInfo or GarbageCollectorMXBean.getLastGcInfo() extensions.
3. Usage Threshold (MemoryPoolMXBean.getUsageThreshold(), MemoryPoolMXBean.setUsageThreshold(long), MemoryPoolMXBean.isUsageThresholdExceeded())
The usage threshold attribute is designed for monitoring the increasing trend of memory usage and incurs only a low overhead.
This attribute is not appropriate for some memory pools.
Use the MemoryPoolMXBean.isUsageThresholdSupported() method to determine
if this functionality is supported by the memory pool to avoid an unexpected UnsupportedOperationException.
The following names are reported for heap memory pools that support the usage threshold attribute:
- JavaHeap
- tenured
- tenured-LOA
- tenured-SOA
- balanced-survivor
- balanced-old
4. Collection Usage Threshold (MemoryPoolMXBean.getCollectionUsageThreshold(), MemoryPoolMXBean.setCollectionUsageThreshold(long), MemoryPoolMXBean.isCollectionUsageThresholdExceeded())
The collection usage threshold is a manageable attribute that is applicable only to some garbage-collected memory pools.
This attribute reports the amount of memory taken up by objects that are still in use after a garbage collection cycle.
Use the MemoryPoolMXBean.isCollectionUsageThresholdSupported() method to determine
if this functionality is supported by the memory pool to avoid an unexpected UnsupportedOperationException.
The following names are reported for heap memory pools that support the collection usage threshold attribute:
- JavaHeap
- tenured
- tenured-LOA
- tenured-SOA
- nursery-allocate
- balanced-eden
- balanced-survivor
- balanced-old
- Since:
- 1.5
-
Method Summary
Modifier and TypeMethodDescriptionIf supported by the virtual machine, returns aMemoryUsagewhich encapsulates this memory pool's memory usage before the most recent run of the garbage collector.Methods declared in interface MemoryPoolMXBean
getCollectionUsage, getCollectionUsageThreshold, getCollectionUsageThresholdCount, getMemoryManagerNames, getName, getPeakUsage, getType, getUsage, getUsageThreshold, getUsageThresholdCount, isCollectionUsageThresholdExceeded, isCollectionUsageThresholdSupported, isUsageThresholdExceeded, isUsageThresholdSupported, isValid, resetPeakUsage, setCollectionUsageThreshold, setUsageThresholdModifier and TypeMethodDescriptionReturns the memory usage after the Java virtual machine most recently expended effort in recycling unused objects in this memory pool.longReturns the collection usage threshold value of this memory pool in bytes.longReturns the number of times that the Java virtual machine has detected that the memory usage has reached or exceeded the collection usage threshold.String[]Returns the name of memory managers that manages this memory pool.getName()Returns the name representing this memory pool.Returns the peak memory usage of this memory pool since the Java virtual machine was started or since the peak was reset.getType()Returns the type of this memory pool.getUsage()Returns an estimate of the memory usage of this memory pool.longReturns the usage threshold value of this memory pool in bytes.longReturns the number of times that the memory usage has crossed the usage threshold.booleanTests if the memory usage of this memory pool after the most recent collection on which the Java virtual machine has expended effort has reached or exceeded its collection usage threshold.booleanTests if this memory pool supports a collection usage threshold.booleanTests if the memory usage of this memory pool reaches or exceeds its usage threshold value.booleanTests if this memory pool supports usage threshold.booleanisValid()Tests if this memory pool is valid in the Java virtual machine.voidResets the peak memory usage statistic of this memory pool to the current memory usage.voidsetCollectionUsageThreshold(long threshold) Sets the collection usage threshold of this memory pool to the giventhresholdvalue.voidsetUsageThreshold(long threshold) Sets the threshold of this memory pool to the giventhresholdvalue if this memory pool supports the usage threshold.Methods declared in interface PlatformManagedObject
getObjectNameModifier and TypeMethodDescriptionReturns anObjectNameinstance representing the object name of this platform managed object.
-
Method Details
-
getPreCollectionUsage
MemoryUsage getPreCollectionUsage()If supported by the virtual machine, returns aMemoryUsagewhich encapsulates this memory pool's memory usage before the most recent run of the garbage collector. No garbage collection will be actually occur as a result of this method getting called.The method will return a
MBeanServer access:nullif the virtual machine does not support this type of functionality.
The return value will be mapped to aCompositeDatawith attributes as specified inMemoryUsage.- Returns:
- a
MemoryUsagecontaining the usage details for the memory pool just before the most recent collection occurred.
-