public abstract class MemoryLayoutSpecification
extends java.lang.Object
限定符和类型 | 字段和说明 |
---|---|
static MemoryLayoutSpecification |
SPEC |
构造器和说明 |
---|
MemoryLayoutSpecification() |
限定符和类型 | 方法和说明 |
---|---|
abstract int |
getArrayHeaderSize() |
abstract int |
getObjectHeaderSize() |
abstract int |
getObjectPadding() |
abstract int |
getReferenceSize() |
abstract int |
getSuperclassFieldPadding() |
static boolean |
hasUnsafe() |
static int |
sizeOf(java.lang.reflect.Field field) |
static long |
sizeOf(java.lang.Object obj) |
static long |
sizeOfArray(int length,
java.lang.Class<?> type)
Memory an array
|
static long |
sizeOfArray(int length,
long elementSize)
Memory an array will consume
|
static long |
sizeOfArray(java.lang.Object instance,
java.lang.Class<?> type) |
static int |
sizeOfField(java.lang.Class<?> type) |
static long |
sizeOfInstance(java.lang.Class<?> type) |
static long |
sizeOfInstanceWithUnsafe(java.lang.Class<?> type) |
static long |
sizeOfWithUnsafe(java.lang.Object obj) |
public static final MemoryLayoutSpecification SPEC
public abstract int getArrayHeaderSize()
public abstract int getObjectHeaderSize()
public abstract int getObjectPadding()
public abstract int getReferenceSize()
public abstract int getSuperclassFieldPadding()
public static boolean hasUnsafe()
public static int sizeOf(java.lang.reflect.Field field)
public static int sizeOfField(java.lang.Class<?> type)
public static long sizeOf(java.lang.Object obj)
public static long sizeOfWithUnsafe(java.lang.Object obj)
public static long sizeOfInstance(java.lang.Class<?> type)
public static long sizeOfInstanceWithUnsafe(java.lang.Class<?> type)
public static long sizeOfArray(java.lang.Object instance, java.lang.Class<?> type)
public static long sizeOfArray(int length, java.lang.Class<?> type)
length
- Number of elements in the arraytype
- the array class typepublic static long sizeOfArray(int length, long elementSize)
length
- Number of elements in the arrayelementSize
- In-memory size of each element's primitive stored