Interface MemoryMXBean

All Superinterfaces:
MemoryMXBean, PlatformManagedObject

public interface MemoryMXBean extends MemoryMXBean
Platform-specific management interface for a garbage collector which performs collections in cycles.

GarbageCollectorMXBean is an interface used by the management system to access garbage collector properties and reset the values of associated counter and accumulator properties.

This platform extension is only available to the garbage collection implementation that supports this extension.

Since:
18
  • Method Details

    • getVersion

      default String getVersion()
      Version of the MemoryMXBean application programming interface. The format for the version is majorVersion.minorVersion.microVersion.
      Returns:
      the version of the MemoryMXBean application programming interface; the null string if no version information is available.
    • getAllocatedBytes

      default long getAllocatedBytes()
      Returns an approximation of the total amount of memory, in bytes, allocated in Java object heap memory since the start of JVM execution. The returned value is an approximation because some Java virtual machine implementations may use object allocation mechanisms that result in a delay between the time an object is allocated and the time its size is recorded.
      Returns:
      an approximation of the total memory allocated, in bytes, in Java object heap memory since the start of JVM execution, if memory allocation measurement is enabled; -1 otherwise.
      Throws:
      UnsupportedOperationException - if the Java virtual machine implementation does not support memory allocation measurement.