public class ApexMemoryHelper extends Object implements IApexMemoryConstants
| Modifier and Type | Field and Description |
|---|---|
static int |
JVM_BYTES_PER_CHAR |
static int |
JVM_MEMORY_CHUNK |
static int |
JVM_STRING_HEADER |
protected static org.slf4j.Logger |
LOGGER |
| Modifier | Constructor and Description |
|---|---|
protected |
ApexMemoryHelper() |
| Modifier and Type | Method and Description |
|---|---|
static void |
deepSize(Instrumentation instrumentation,
IntPredicate identities,
LongAdder totalSize,
Object object) |
static long |
deepSize(Object object) |
static long |
deepSize(Object object,
IntPredicate identityPredicate) |
static long |
deepSizeWithBloomFilter(Object object,
long expectedObjectCardinality) |
static long |
getDoubleMemory() |
static long |
getObjectArrayMemory(Object asArray) |
static long |
getObjectArrayMemory(Object[] asArray) |
static long |
getStringMemory(CharSequence existingRef) |
static long |
memoryAsLong(String targetMax) |
static String |
memoryAsString(long bytes) |
static long |
positivePack(int i1,
int i2)
It might be useful to have an long<->(int,int) packing guaranteeing both integers to be positive if the long is
positive
|
static int |
positiveUnpack1(long packed) |
static int |
positiveUnpack2(long packed) |
static void |
recursiveSize(Instrumentation instrumentation,
IntPredicate identities,
LongAdder totalSize,
Object object)
Deprecated.
|
static long |
recursiveSize(Object object)
Deprecated.
renamed to deepSize
|
static long |
recursiveSize(Object object,
IntPredicate identityPredicate) |
static long |
recursiveSizeWithBloomFilter(Object object,
long expectedObjectCardinality)
Deprecated.
|
protected static final org.slf4j.Logger LOGGER
public static final int JVM_MEMORY_CHUNK
public static final int JVM_BYTES_PER_CHAR
public static final int JVM_STRING_HEADER
public static long getStringMemory(CharSequence existingRef)
@Deprecated public static long recursiveSize(Object object)
public static long deepSize(Object object)
object - the object to analyzepublic static long recursiveSize(Object object, IntPredicate identityPredicate)
public static long deepSize(Object object, IntPredicate identityPredicate)
object - identityPredicate - a predicate returning true if it is the first encounter of given object. It may return false even if
an object has not been considered before, woult it be because the identity policy is not guaranteed
(e.g. we rely on a BloomFilter) or if we want to exclude some objects@Deprecated public static long recursiveSizeWithBloomFilter(Object object, long expectedObjectCardinality)
public static long deepSizeWithBloomFilter(Object object, long expectedObjectCardinality)
@Deprecated public static void recursiveSize(Instrumentation instrumentation, IntPredicate identities, LongAdder totalSize, Object object)
public static void deepSize(Instrumentation instrumentation, IntPredicate identities, LongAdder totalSize, Object object)
instrumentation - an Instrumentation able to provide the memory weight of given objectidentities - an identityHashSet where to collect already handlded objectstotalSize - the LongAdder where to accumulate the memoryobject - the object to analysepublic static long getDoubleMemory()
public static long getObjectArrayMemory(Object[] asArray)
public static long getObjectArrayMemory(Object asArray)
public static final long positivePack(int i1,
int i2)
public static final int positiveUnpack1(long packed)
public static final int positiveUnpack2(long packed)
public static long memoryAsLong(String targetMax)
public static String memoryAsString(long bytes)
Copyright © 2014–2017 Pivotal Software, Inc.. All rights reserved.