Methods Summary |
---|
public static java.lang.management.MemoryUsage | from(javax.management.openmbean.CompositeData cd)Returns a MemoryUsage object represented by the
given CompositeData. The given CompositeData
must contain the following attributes:
Attribute Name |
Type |
init |
java.lang.Long |
used |
java.lang.Long |
committed |
java.lang.Long |
max |
java.lang.Long |
if (cd == null) {
return null;
}
if (cd instanceof MemoryUsageCompositeData) {
return ((MemoryUsageCompositeData) cd).getMemoryUsage();
} else {
return new MemoryUsage(cd);
}
|
public long | getCommitted()Returns the amount of memory in bytes that is committed for
the Java virtual machine to use. This amount of memory is
guaranteed for the Java virtual machine to use.
return committed;
|
public long | getInit()Returns the amount of memory in bytes that the Java virtual machine
initially requests from the operating system for memory management.
This method returns -1 if the initial memory size is undefined.
return init;
|
public long | getMax()Returns the maximum amount of memory in bytes that can be
used for memory management. This method returns -1
if the maximum memory size is undefined.
This amount of memory is not guaranteed to be available
for memory management if it is greater than the amount of
committed memory. The Java virtual machine may fail to allocate
memory even if the amount of used memory does not exceed this
maximum size.
return max;
|
public long | getUsed()Returns the amount of used memory in bytes.
return used;
|
public java.lang.String | toString()Returns a descriptive representation of this memory usage.
StringBuffer buf = new StringBuffer();
buf.append("init = " + init + "(" + (init >> 10) + "K) ");
buf.append("used = " + used + "(" + (used >> 10) + "K) ");
buf.append("committed = " + committed + "(" +
(committed >> 10) + "K) " );
buf.append("max = " + max + "(" + (max >> 10) + "K)");
return buf.toString();
|