Top Description Fields Constructors Methods
net.sf.ehcache.pool.sizeof

public Class UnsafeSizeOf

extends SizeOf
Class Inheritance
Annotations
@SuppressWarnings:restriction
Imports
java.lang.reflect.Array, .Field, .Modifier, org.slf4j.Logger, .LoggerFactory, net.sf.ehcache.pool.sizeof.filter.PassThroughFilter, .SizeOfFilter, sun.misc.Unsafe

sun.misc.Unsafe#theUnsafe based sizeOf measurement All constructors will throw UnsupportedOperationException if theUnsafe isn't accessible on this platform
Author
Chris Dennis

Field Summary

Modifier and TypeField and Description
private static final Logger
private static final Unsafe

Constructor Summary

AccessConstructor and Description
public
UnsafeSizeOf()

Builds a new SizeOf that will not filter fields and will cache reflected fields

public
UnsafeSizeOf(SizeOfFilter
The filter to apply
filter
)

Builds a new SizeOf that will filter fields according to the provided filter and will cache reflected fields

public
UnsafeSizeOf(SizeOfFilter
The filter to apply
filter
,
boolean
whether to cache reflected fields
caching
)

Builds a new SizeOf that will filter fields according to the provided filter

Method Summary

Modifier and TypeMethod and Description
public long
sizeOf(Object
the object to measure the size of
obj
)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph
Inherited from net.sf.ehcache.pool.sizeof.SizeOf:
deepSizeOf

Field Detail

LOGGERback to summary
private static final Logger LOGGER
UNSAFEback to summary
private static final Unsafe UNSAFE

Constructor Detail

UnsafeSizeOfback to summary
public UnsafeSizeOf() throws UnsupportedOperationException

Builds a new SizeOf that will not filter fields and will cache reflected fields

Exceptions
UnsupportedOperationException:
If Unsafe isn't accessible
See Also
UnsafeSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean)
UnsafeSizeOfback to summary
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:SizeOfFilter

The filter to apply

Exceptions
UnsupportedOperationException:
If Unsafe isn't accessible
See Also
UnsafeSizeOf(net.sf.ehcache.pool.sizeof.filter.SizeOfFilter, boolean), SizeOfFilter
UnsafeSizeOfback to summary
public UnsafeSizeOf(SizeOfFilter filter, boolean caching) throws UnsupportedOperationException

Builds a new SizeOf that will filter fields according to the provided filter

Parameters
filter:SizeOfFilter

The filter to apply

caching:boolean

whether to cache reflected fields

Exceptions
UnsupportedOperationException:
If Unsafe isn't accessible
See Also
SizeOfFilter

Method Detail

sizeOfback to summary
public long sizeOf(Object obj)

Implements abstract net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Doc from net.sf.ehcache.pool.sizeof.SizeOf.sizeOf.

Calculates the size in memory (heap) of the instance passed in, not navigating the down graph

Parameters
obj:Object

the object to measure the size of

Returns:long

the object size in memory in bytes

Annotations
@Override