-
- All Superinterfaces:
PlatformManagedObject
- All Known Subinterfaces:
MemoryMXBean
public interface MemoryMXBean extends PlatformManagedObject
The management and monitoring interface for a virtual machine's memory system.Precisely one instance of this interface will be made available to management clients.
Accessing this
MXBeancan be done in one of three ways.- Invoking the static
ManagementFactory.getMemoryMXBean()method. - Using a
MBeanServerConnection. - Obtaining a proxy MXBean from the static
ManagementFactory.newPlatformMXBeanProxy(javax.management.MBeanServerConnection, java.lang.String, java.lang.Class<T>)method, passing in the string "java.lang:type=ClassLoading" for the value of the second parameter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidgc()Requests the virtual machine to run the system garbage collector.MemoryUsagegetHeapMemoryUsage()Returns the current memory usage of the heap for both live objects and for objects no longer in use which are awaiting garbage collection.MemoryUsagegetNonHeapMemoryUsage()Returns the current non-heap memory usage for the virtual machine.intgetObjectPendingFinalizationCount()Returns the number of objects in the virtual machine that are awaiting finalization.booleanisVerbose()Returns a boolean indication of whether or not the memory system is producing verbose output.voidsetVerbose(boolean value)Updates the verbose output setting of the memory system.-
Methods declared in interface java.lang.management.PlatformManagedObject
getObjectName
-
-
-
-
Method Detail
-
gc
void gc()
Requests the virtual machine to run the system garbage collector.
-
getHeapMemoryUsage
MemoryUsage getHeapMemoryUsage()
Returns the current memory usage of the heap for both live objects and for objects no longer in use which are awaiting garbage collection.- Returns:
- an instance of
MemoryUsagewhich can be interrogated by the caller.
-
getNonHeapMemoryUsage
MemoryUsage getNonHeapMemoryUsage()
Returns the current non-heap memory usage for the virtual machine.- Returns:
- an instance of
MemoryUsagewhich can be interrogated by the caller.
-
getObjectPendingFinalizationCount
int getObjectPendingFinalizationCount()
Returns the number of objects in the virtual machine that are awaiting finalization. The returned value should only be used as an approximate guide.- Returns:
- the number of objects awaiting finalization.
-
isVerbose
boolean isVerbose()
Returns a boolean indication of whether or not the memory system is producing verbose output.- Returns:
trueif verbose output is being produced ;falseotherwise.
-
setVerbose
void setVerbose(boolean value)
Updates the verbose output setting of the memory system.- Parameters:
value-trueenables verbose output ;falsedisables verbose output.- Throws:
SecurityException- if aSecurityManageris being used and the caller does not have theManagementPermissionvalue of "control".- See Also:
ManagementPermission
-
-