@FunctionalInterface public interface MemoryMeterStrategy
| Modifier and Type | Field and Description |
|---|---|
static MemoryLayoutSpecification |
MEMORY_LAYOUT
The memory layout detected by JAMM.
|
| Modifier and Type | Method and Description |
|---|---|
default long |
computeArraySize(int length,
int elementSize)
Computes an array size from its length and element size (optional operation).
|
long |
measure(Object object)
Measures the shallow memory used by the specified object.
|
default long |
measureArray(boolean[] array)
Measures the shallow memory used by the specified boolean array.
|
default long |
measureArray(byte[] array)
Measures the shallow memory used by the specified byte array.
|
default long |
measureArray(char[] array)
Measures the shallow memory used by the specified char array.
|
default long |
measureArray(double[] array)
Measures the shallow memory used by the specified double array.
|
default long |
measureArray(float[] array)
Measures the shallow memory used by the specified float array.
|
default long |
measureArray(int[] array)
Measures the shallow memory used by the specified int array.
|
default long |
measureArray(long[] array)
Measures the shallow memory used by the specified long array.
|
default long |
measureArray(Object[] array)
Measures the shallow memory used by the specified array.
|
default long |
measureArray(Object array,
Class<?> type)
Measures the shallow memory used by the specified array.
|
default long |
measureArray(short[] array)
Measures the shallow memory used by the specified short array.
|
default boolean |
supportComputeArraySize()
Checks if this instance supports the
computeArraySize operation. |
static final MemoryLayoutSpecification MEMORY_LAYOUT
long measure(Object object)
object - the object to measuredefault long measureArray(Object array, Class<?> type)
array - the array to measuretype - the array typedefault long measureArray(Object[] array)
array - the array to measuredefault long measureArray(byte[] array)
array - the array to measuredefault long measureArray(boolean[] array)
array - the boolean array to measuredefault long measureArray(short[] array)
array - the short array to measuredefault long measureArray(char[] array)
array - the char array to measuredefault long measureArray(int[] array)
array - the int array to measuredefault long measureArray(float[] array)
array - the float array to measuredefault long measureArray(long[] array)
array - the long array to measuredefault long measureArray(double[] array)
array - the long array to measuredefault boolean supportComputeArraySize()
computeArraySize operation.true if this instance support the computeArraySize operation, false otherwise.default long computeArraySize(int length,
int elementSize)
supportComputeArraySize should be used before calling this method to check if this operation is supported.
length - the array lengthelementSize - the size of the elementsUnsupportedOperationException - if the operation is not supportedCopyright © 2023. All rights reserved.