Interface MemoryPoolMXBean

All Superinterfaces:
MemoryPoolMXBean, PlatformManagedObject
All Known Implementing Classes:
MemoryPoolMXBeanImpl

public interface MemoryPoolMXBean extends MemoryPoolMXBean
The OpenJ9 interface for managing and monitoring the virtual machine's memory pools. The following list describes 4 common behavior changes for 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 using MemoryPoolMXBean.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 Details

    • getPreCollectionUsage

      MemoryUsage getPreCollectionUsage()
      If supported by the virtual machine, returns a MemoryUsage which 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 null if the virtual machine does not support this type of functionality.

      MBeanServer access:
      The return value will be mapped to a CompositeData with attributes as specified in MemoryUsage.
      Returns:
      a MemoryUsage containing the usage details for the memory pool just before the most recent collection occurred.