org.github.jamm
Class MemoryMeter

java.lang.Object
  extended by org.github.jamm.MemoryMeter

public class MemoryMeter
extends Object


Constructor Summary
MemoryMeter()
           
 
Method Summary
 long countChildren(Object object)
           
static boolean isInitialized()
           
 long measure(Object object)
           
 long measureDeep(Object object)
           
 MemoryMeter omitSharedBufferOverhead()
           
static void premain(String options, Instrumentation inst)
           
 MemoryMeter withTrackerProvider(Callable<Set<Object>> trackerProvider)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryMeter

public MemoryMeter()
Method Detail

premain

public static void premain(String options,
                           Instrumentation inst)

isInitialized

public static boolean isInitialized()

withTrackerProvider

public MemoryMeter withTrackerProvider(Callable<Set<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(Object object)
Returns:
the shallow memory usage of @param object
Throws:
NullPointerException - if object is null

measureDeep

public long measureDeep(Object object)
Returns:
the memory usage of @param object including referenced objects
Throws:
NullPointerException - if object is null

countChildren

public long countChildren(Object object)
Returns:
the number of child objects referenced by @param object
Throws:
NullPointerException - if object is null


Copyright © 2011. All Rights Reserved.