org.github.jamm
Class MemoryMeter
java.lang.Object
org.github.jamm.MemoryMeter
public class MemoryMeter
- extends java.lang.Object
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MemoryMeter
public MemoryMeter()
premain
public static void premain(java.lang.String options,
java.lang.instrument.Instrumentation inst)
isInitialized
public static boolean isInitialized()
withTrackerProvider
public MemoryMeter withTrackerProvider(java.util.concurrent.Callable<java.util.Set<java.lang.Object>> trackerProvider)
- Parameters:
trackerProvider -
- Returns:
- a MemoryMeter with the given provider
omitSharedBufferOverhead
public MemoryMeter omitSharedBufferOverhead()
- Returns:
- a MemoryMeter that only counts the bytes remaining in a ByteBuffer
in measureDeep, rather than the full size of the backing array.
TODO: handle other types of Buffers
measure
public long measure(java.lang.Object object)
- Returns:
- the shallow memory usage of @param object
- Throws:
java.lang.NullPointerException - if object is null
measureDeep
public long measureDeep(java.lang.Object object)
- Returns:
- the memory usage of @param object including referenced objects
- Throws:
java.lang.NullPointerException - if object is null
countChildren
public long countChildren(java.lang.Object object)
- Returns:
- the number of child objects referenced by @param object
- Throws:
java.lang.NullPointerException - if object is null
Copyright © 2011. All Rights Reserved.