Package org.ehcache.sizeof
Class SizeOf
java.lang.Object
org.ehcache.sizeof.SizeOf
- Direct Known Subclasses:
AgentSizeOf
,ReflectionSizeOf
,UnsafeSizeOf
Abstract sizeOf for Java. It will rely on a proper sizeOf to measure sizes of entire object graphs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
Will Cache already visited typesprivate class
Will return the sizeOf each instance -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSizeOf
(SizeOfFilter fieldFilter, boolean caching, boolean bypassFlyweight) Builds a new SizeOf that will filter fields according to the provided filter -
Method Summary
Modifier and TypeMethodDescriptionlong
deepSizeOf
(Object... obj) long
deepSizeOf
(VisitorListener listener, Object... obj) Measures the size in memory (heap) of the objects passed in, walking their graph down Any overlap of the graphs being passed in will be recognized and only measured oncestatic SizeOf
newInstance
(boolean bypassFlyweight, boolean cache, SizeOfFilter... filters) static SizeOf
newInstance
(SizeOfFilter... filters) abstract long
Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
-
Field Details
-
walker
-
-
Constructor Details
-
SizeOf
Builds a new SizeOf that will filter fields according to the provided filter- Parameters:
fieldFilter
- The filter to applycaching
- whether to cache reflected fieldsbypassFlyweight
- whether "Flyweight Objects" are to be ignored- See Also:
-
-
Method Details
-
sizeOf
Calculates the size in memory (heap) of the instance passed in, not navigating the down graph- Parameters:
obj
- the object to measure the size of- Returns:
- the object size in memory in bytes
-
deepSizeOf
Measures the size in memory (heap) of the objects passed in, walking their graph down Any overlap of the graphs being passed in will be recognized and only measured once- Parameters:
listener
- A listener to visited objectsobj
- the root objects of the graphs to measure- Returns:
- the total size in bytes for these objects
- See Also:
-
deepSizeOf
-
newInstance
-
newInstance
-