Class Overview
Estimates the size of a given Object using a given MemoryModel for primitive
size information.
Resource Usage:
Internally uses a Map to temporally hold a reference to every
object seen.
If checkIntered, all Strings checked will be interned, but those
that were not already interned will be released for GC when the
estimate is complete.
Summary
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Public Constructors
public
RamUsageEstimator
()
Constructs this object with an AverageGuessMemoryModel and
checkInterned = true.
public
RamUsageEstimator
(boolean checkInterned)
Parameters
checkInterned
| check if Strings are interned and don't add to size
if they are. Defaults to true but if you know the objects you are checking
won't likely contain many interned Strings, it will be faster to turn off
intern checking.
|
public
RamUsageEstimator
(MemoryModel memoryModel)
Parameters
memoryModel
| MemoryModel to use for primitive object sizes.
|
public
RamUsageEstimator
(MemoryModel memoryModel, boolean checkInterned)
Parameters
memoryModel
| MemoryModel to use for primitive object sizes. |
checkInterned
| check if Strings are interned and don't add to size
if they are. Defaults to true but if you know the objects you are checking
won't likely contain many interned Strings, it will be faster to turn off
intern checking.
|
Public Methods
public
long
estimateRamUsage
(Object obj)
public
static
String
humanReadableUnits
(long bytes, DecimalFormat df)
Return good default units based on byte size.