Package com.carrotsearch.hppc
Class RamUsageEstimator
- java.lang.Object
-
- com.carrotsearch.hppc.RamUsageEstimator
-
public class RamUsageEstimator extends java.lang.ObjectHelper class that helps estimate memory usageMostly forked from Lucene tag releases/lucene-solr/8.5.1
-
-
Field Summary
Fields Modifier and Type Field Description static booleanCOMPRESSED_REFS_ENABLEDTrue, iff compressed references (oops) are enabled by this JVMstatic intNUM_BYTES_ARRAY_HEADERNumber of bytes to represent an array header (no content, but with alignments).static intNUM_BYTES_OBJECT_ALIGNMENTA constant specifying the object alignment boundary inside the JVM.static intNUM_BYTES_OBJECT_HEADERNumber of bytes to represent an object header (no fields, no alignments).static intNUM_BYTES_OBJECT_REFNumber of bytes this JVM uses to represent an object reference.static longONE_GBOne gigabyte bytes.static longONE_KBOne kilobyte bytes.static longONE_MBOne megabyte bytes.static java.util.Map<java.lang.Class<?>,java.lang.Integer>primitiveSizesSizes of primitive classes.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static longalignObjectSize(long size)Aligns an object size to be the next multiple ofNUM_BYTES_OBJECT_ALIGNMENT.static longshallowSizeOfArray(java.lang.Object array)Return shallow size of anyarray.static longshallowUsedSizeOfArray(java.lang.Object array, int usedSize)Return used part of shallow size of anyarray.
-
-
-
Field Detail
-
ONE_KB
public static final long ONE_KB
One kilobyte bytes.- See Also:
- Constant Field Values
-
ONE_MB
public static final long ONE_MB
One megabyte bytes.- See Also:
- Constant Field Values
-
ONE_GB
public static final long ONE_GB
One gigabyte bytes.- See Also:
- Constant Field Values
-
COMPRESSED_REFS_ENABLED
public static final boolean COMPRESSED_REFS_ENABLED
True, iff compressed references (oops) are enabled by this JVM
-
NUM_BYTES_OBJECT_REF
public static final int NUM_BYTES_OBJECT_REF
Number of bytes this JVM uses to represent an object reference.
-
NUM_BYTES_OBJECT_HEADER
public static final int NUM_BYTES_OBJECT_HEADER
Number of bytes to represent an object header (no fields, no alignments).
-
NUM_BYTES_ARRAY_HEADER
public static final int NUM_BYTES_ARRAY_HEADER
Number of bytes to represent an array header (no content, but with alignments).
-
NUM_BYTES_OBJECT_ALIGNMENT
public 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.
-
primitiveSizes
public static final java.util.Map<java.lang.Class<?>,java.lang.Integer> primitiveSizes
Sizes of primitive classes.
-
-
Method Detail
-
alignObjectSize
public static long alignObjectSize(long size)
Aligns an object size to be the next multiple ofNUM_BYTES_OBJECT_ALIGNMENT.
-
shallowUsedSizeOfArray
public static long shallowUsedSizeOfArray(java.lang.Object array, int usedSize)Return used part of shallow size of anyarray.- Parameters:
usedSize- Size that array is actually used
-
shallowSizeOfArray
public static long shallowSizeOfArray(java.lang.Object array)
Return shallow size of anyarray.
-
-