Name

MemoryMXBean

Synopsis

This MXBean interface allows monitoring of current memory usage information for heap memory (allocated objects) and nonheap memory (loaded classes and libraries). It also allows the garbage collector to be explicitly invoked and verbose garbage-collection related output to be turned on or off.

See MemoryUsage for details on how memory usage information is returned. See also MemoryPoolMXBean for a way to obtain both current and peak memory usage for individual memory pools.

public interface MemoryMXBean {
// Public Instance Methods
     void gc( );  
     MemoryUsage getHeapMemoryUsage( );  
     MemoryUsage getNonHeapMemoryUsage( );  
     int getObjectPendingFinalizationCount( );  
     boolean isVerbose( );  
     void setVerbose(boolean value);  
}

Returned By

ManagementFactory.getMemoryMXBean( )

Get Java in a Nutshell, 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.