Package org.ehcache.sizeof.impl
Class ReflectionSizeOf
- java.lang.Object
-
- org.ehcache.sizeof.SizeOf
-
- org.ehcache.sizeof.impl.ReflectionSizeOf
-
public class ReflectionSizeOf extends SizeOf
SizeOf that uses reflection to measure on heap size of object graphs Inspired by Dr. Heinz Kabutz's Java Specialist Newsletter Issue #78
-
-
Field Summary
Fields Modifier and Type Field Description private static org.slf4j.Logger
LOGGER
-
Constructor Summary
Constructors Constructor Description ReflectionSizeOf()
Builds a new SizeOf that will not filter fields and will cache reflected fieldsReflectionSizeOf(SizeOfFilter fieldFilter)
Builds a new SizeOf that will filter fields and will cache reflected fieldsReflectionSizeOf(SizeOfFilter fieldFilter, boolean caching, boolean bypassFlyweight)
Builds a new SizeOf that will filter fields
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private long
guessArraySize(java.lang.Object obj)
long
sizeOf(java.lang.Object obj)
Calculates the size in memory (heap) of the instance passed in, not navigating the down graph-
Methods inherited from class org.ehcache.sizeof.SizeOf
deepSizeOf, deepSizeOf, newInstance, newInstance
-
-
-
-
Constructor Detail
-
ReflectionSizeOf
public ReflectionSizeOf()
Builds a new SizeOf that will not filter fields and will cache reflected fields
-
ReflectionSizeOf
public ReflectionSizeOf(SizeOfFilter fieldFilter)
Builds a new SizeOf that will filter fields and will cache reflected fields- Parameters:
fieldFilter
- The filter to apply- See Also:
ReflectionSizeOf(SizeOfFilter, boolean, boolean)
,SizeOfFilter
-
ReflectionSizeOf
public ReflectionSizeOf(SizeOfFilter fieldFilter, boolean caching, boolean bypassFlyweight)
Builds a new SizeOf that will filter fields- Parameters:
fieldFilter
- The filter to applycaching
- Whether to cache reflected fieldsbypassFlyweight
- whether "Flyweight Objects" are to be ignored- See Also:
SizeOfFilter
-
-