ehcache

net.sf.ehcache.pool.sizeof
Class UnsafeSizeOf

java.lang.Object
  extended by net.sf.ehcache.pool.sizeof.SizeOf
      extended by net.sf.ehcache.pool.sizeof.UnsafeSizeOf

public class UnsafeSizeOf
extends SizeOf

Unsafe.theUnsafe based sizeOf measurement All constructors will throw UnsupportedOperationException if theUnsafe isn't accessible on this platform

Author:
Chris Dennis

Constructor Summary
UnsafeSizeOf()
          Builds a new SizeOf that will not filter fields and will cache reflected fields
UnsafeSizeOf(SizeOfFilter filter)
          Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields
UnsafeSizeOf(SizeOfFilter filter, boolean caching)
          Builds a new SizeOf that will filter fields according to the provided filter
 
Method Summary
 long sizeOf(Object obj)
          Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
 
Methods inherited from class net.sf.ehcache.pool.sizeof.SizeOf
deepSizeOf
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnsafeSizeOf

public UnsafeSizeOf()
             throws UnsupportedOperationException
Builds a new SizeOf that will not filter fields and will cache reflected fields

Throws:
UnsupportedOperationException - If Unsafe isn't accessible
See Also:
UnsafeSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean)

UnsafeSizeOf

public UnsafeSizeOf(SizeOfFilter filter)
             throws UnsupportedOperationException
Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields

Parameters:
filter - The filter to apply
Throws:
UnsupportedOperationException - If Unsafe isn't accessible
See Also:
UnsafeSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean), SizeOfFilter

UnsafeSizeOf

public UnsafeSizeOf(SizeOfFilter filter,
                    boolean caching)
             throws UnsupportedOperationException
Builds a new SizeOf that will filter fields according to the provided filter

Parameters:
filter - The filter to apply
caching - whether to cache reflected fields
Throws:
UnsupportedOperationException - If Unsafe isn't accessible
See Also:
SizeOfFilter
Method Detail

sizeOf

public long sizeOf(Object obj)
Calculates the size in memory (heap) of the instance passed in, not navigating the down graph

Specified by:
sizeOf in class SizeOf
Parameters:
obj - the object to measure the size of
Returns:
the object size in memory in bytes

ehcache

Copyright 2001-2014, Terracotta, Inc.