public class RamUsageEstimator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static boolean |
COMPRESSED_REFS_ENABLED
True, iff compressed references (oops) are enabled by this JVM
|
static int |
NUM_BYTES_ARRAY_HEADER
Number of bytes to represent an array header (no content, but with alignments).
|
static int |
NUM_BYTES_OBJECT_ALIGNMENT
A constant specifying the object alignment boundary inside the JVM.
|
static int |
NUM_BYTES_OBJECT_HEADER
Number of bytes to represent an object header (no fields, no alignments).
|
static int |
NUM_BYTES_OBJECT_REF
Number of bytes this JVM uses to represent an object reference.
|
static long |
ONE_GB
One gigabyte bytes.
|
static long |
ONE_KB
One kilobyte bytes.
|
static long |
ONE_MB
One megabyte bytes.
|
static java.util.Map<java.lang.Class<?>,java.lang.Integer> |
primitiveSizes
Sizes of primitive classes.
|
Modifier and Type | Method and Description |
---|---|
static long |
alignObjectSize(long size)
Aligns an object size to be the next multiple of
NUM_BYTES_OBJECT_ALIGNMENT . |
static long |
shallowSizeOf(java.lang.Object obj)
Estimates a "shallow" memory usage of the given object.
|
static long |
shallowSizeOfInstance(java.lang.Class<?> clazz)
Returns the shallow instance size in bytes an instance of the given class would occupy.
|
static long |
shallowUsedSizeOfArray(java.lang.Object array,
int usedSize)
Return used part of shallow size of any
array . |
public static final long ONE_KB
public static final long ONE_MB
public static final long ONE_GB
public static final boolean COMPRESSED_REFS_ENABLED
public static final int NUM_BYTES_OBJECT_REF
public static final int NUM_BYTES_OBJECT_HEADER
public static final int NUM_BYTES_ARRAY_HEADER
public static final int NUM_BYTES_OBJECT_ALIGNMENT
public static final java.util.Map<java.lang.Class<?>,java.lang.Integer> primitiveSizes
public static long alignObjectSize(long size)
NUM_BYTES_OBJECT_ALIGNMENT
.public static long shallowSizeOfInstance(java.lang.Class<?> clazz)
java.lang.IllegalArgumentException
- if clazz
is an array class.shallowSizeOf(Object)
public static long shallowSizeOf(java.lang.Object obj)
public static long shallowUsedSizeOfArray(java.lang.Object array, int usedSize)
array
.usedSize
- Size that array is actually usedCopyright © 2024 Carrot Search s.c.. All rights reserved.