Top Description Fields Constructors Methods
com.carrotsearch.hppc

pack-priv final Class RamUsageEstimator

extends Object
Class Inheritance
Imports
java.lang.reflect.Array, .Method, java.util.Collections, .IdentityHashMap, .Map

Helper class that helps estimate memory usage

Mostly forked from Lucene tag releases/lucene-solr/8.5.1

Field Summary

Modifier and TypeField and Description
pack-priv static final boolean
COMPRESSED_REFS_ENABLED

True, iff compressed references (oops) are enabled by this JVM

pack-priv static final String
pack-priv static final boolean
pack-priv static final String
pack-priv static final int
NUM_BYTES_ARRAY_HEADER

Number of bytes to represent an array header (no content, but with alignments).

pack-priv static final int
NUM_BYTES_OBJECT_ALIGNMENT

A constant specifying the object alignment boundary inside the JVM.

pack-priv static final int
NUM_BYTES_OBJECT_HEADER

Number of bytes to represent an object header (no fields, no alignments).

pack-priv static final int
NUM_BYTES_OBJECT_REF

Number of bytes this JVM uses to represent an object reference.

pack-priv static final String
pack-priv static final Map<Class<?>, Integer>
primitiveSizes

Sizes of primitive classes.

Constructor Summary

AccessConstructor and Description
private
RamUsageEstimator()

No instantiation.

Method Summary

Modifier and TypeMethod and Description
pack-priv static long
alignObjectSize(long size)

Aligns an object size to be the next multiple of NUM_BYTES_OBJECT_ALIGNMENT.

pack-priv static long
shallowSizeOfArray(Object array)

Return shallow size of any array.

pack-priv static long
shallowUsedSizeOfArray(Object array, int
Size that array is actually used
usedSize
)

Return used part of shallow size of any array.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COMPRESSED_REFS_ENABLEDback to summary
pack-priv static final boolean COMPRESSED_REFS_ENABLED

True, iff compressed references (oops) are enabled by this JVM

HOTSPOT_BEAN_CLASSback to summary
pack-priv static final String HOTSPOT_BEAN_CLASS
JRE_IS_64BITback to summary
pack-priv static final boolean JRE_IS_64BIT
MANAGEMENT_FACTORY_CLASSback to summary
pack-priv static final String MANAGEMENT_FACTORY_CLASS
NUM_BYTES_ARRAY_HEADERback to summary
pack-priv static final int NUM_BYTES_ARRAY_HEADER

Number of bytes to represent an array header (no content, but with alignments).

NUM_BYTES_OBJECT_ALIGNMENTback to summary
pack-priv static final int NUM_BYTES_OBJECT_ALIGNMENT

A constant specifying the object alignment boundary inside the JVM. Objects will always take a full multiple of this constant, possibly wasting some space.

NUM_BYTES_OBJECT_HEADERback to summary
pack-priv static final int NUM_BYTES_OBJECT_HEADER

Number of bytes to represent an object header (no fields, no alignments).

NUM_BYTES_OBJECT_REFback to summary
pack-priv static final int NUM_BYTES_OBJECT_REF

Number of bytes this JVM uses to represent an object reference.

OS_ARCHback to summary
pack-priv static final String OS_ARCH
primitiveSizesback to summary
pack-priv static final Map<Class<?>, Integer> primitiveSizes

Sizes of primitive classes.

Constructor Detail

RamUsageEstimatorback to summary
private RamUsageEstimator()

No instantiation.

Method Detail

alignObjectSizeback to summary
pack-priv static long alignObjectSize(long size)

Aligns an object size to be the next multiple of NUM_BYTES_OBJECT_ALIGNMENT.

shallowSizeOfArrayback to summary
pack-priv static long shallowSizeOfArray(Object array)

Return shallow size of any array.

shallowUsedSizeOfArrayback to summary
pack-priv static long shallowUsedSizeOfArray(Object array, int usedSize)

Return used part of shallow size of any array.

Parameters
usedSize:int

Size that array is actually used