public final class RamUsageEstimator extends Object
Constructor and Description |
---|
RamUsageEstimator()
Constructs this object with an AverageGuessMemoryModel and
checkInterned = true.
|
RamUsageEstimator(boolean checkInterned) |
RamUsageEstimator(MemoryModel memoryModel) |
RamUsageEstimator(MemoryModel memoryModel,
boolean checkInterned) |
Modifier and Type | Method and Description |
---|---|
long |
estimateRamUsage(Object obj) |
static String |
humanReadableUnits(long bytes,
DecimalFormat df)
Return good default units based on byte size.
|
public RamUsageEstimator()
public RamUsageEstimator(boolean checkInterned)
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)
memoryModel
- MemoryModel to use for primitive object sizes.public RamUsageEstimator(MemoryModel memoryModel, boolean checkInterned)
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 long estimateRamUsage(Object obj)
public static String humanReadableUnits(long bytes, DecimalFormat df)
Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.