| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private static final int | |
| private static boolean | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| pack-priv static boolean | |
| private static final int | |
| public static final int | |
| private static final int | |
| pack-priv static boolean | |
| private static final int[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns: the size estimate, in bytesthe class cls)Estimate the static space taken up by a class instance. |
| public static int | Returns: the estimated overhead of an array. The estimated size of an x[n] array is estimateArrayOverhead() + n*sizeOf(x).
|
| public static int | Returns: the size estimate in bytes.A class cl)Estimate the static space taken up by the fields of a class. |
| public static int | Returns: the size estimate, in bytesthe class cls)Estimate the static space taken up by a class instance from cataloged coefficients. |
| private static int | |
| public static int | Returns: the size estimate, in bytesthe coefficients coeff)Estimate the static space taken up by a class instance given the coefficients returned by getSizeCoefficients. |
| public static int | |
| public static int | Returns: the estimated size, in bytesThe string str)Estimate the size of a string. |
| private static final int | Returns: The reference size in bytes as specified or implied by the VM, or-1 if the reference size couldn't be determined.Tries to determine the reference size in bytes by checking whether the VM we're running in is 32 or 64 bit by looking at the system properties. |
| public static int | |
| public static int | |
| public static int[] | Returns: an array of 2 integers. The first integer is the constant part of the function, the second is the reference size coefficient.A class whose instance size is to be estimated cl)The estimate of the size of a class instance depends on whether the JVM uses 32 or 64 bit addresses, that is it depends on the size of an object reference. |
| private static final String | Returns: The property value, ornull if it doesn't exist or the
required permission to read the property is missing.name of the system property to read propName)Attempts to read the specified system property. |
| private static void | |
| public static void |
| booleanSize | back to summary |
|---|---|
| private static final int booleanSize | |
| charSize | back to summary |
|---|---|
| private static final int charSize | |
| doubleSize | back to summary |
|---|---|
| private static final int doubleSize | |
| dummyCatalog | back to summary |
|---|---|
| private static boolean dummyCatalog | |
| floatSize | back to summary |
|---|---|
| private static final int floatSize | |
| intSize | back to summary |
|---|---|
| private static final int intSize | |
| longSize | back to summary |
|---|---|
| private static final int longSize | |
| minObjectSize | back to summary |
|---|---|
| private static final int minObjectSize | |
| noGuess | back to summary |
|---|---|
| pack-priv static boolean noGuess | |
| objectOverhead | back to summary |
|---|---|
| private static final int objectOverhead | |
| refSize | back to summary |
|---|---|
| public static final int refSize | |
| shortSize | back to summary |
|---|---|
| private static final int shortSize | |
| unitTest | back to summary |
|---|---|
| pack-priv static boolean unitTest | |
| wildGuess | back to summary |
|---|---|
| private static final int[] wildGuess | |
| ClassSize | back to summary |
|---|---|
| public ClassSize() | |
| estimateAndCatalogBase | back to summary |
|---|---|
| public static int estimateAndCatalogBase(Class<T> cls) Estimate the static space taken up by a class instance. Save the coefficients in a catalog.
| |
| estimateArrayOverhead | back to summary |
|---|---|
public static int estimateArrayOverhead()
| |
| estimateBase | back to summary |
|---|---|
| public static int estimateBase(Class<T> cl) Estimate the static space taken up by the fields of a class. This includes the space taken up by by references (the pointer) but not by the referenced object. So the estimated size of an array field does not depend on the size of the array. Similarly the size of an object (reference) field does not depend on the object.
| |
| estimateBaseFromCatalog | back to summary |
|---|---|
| public static int estimateBaseFromCatalog(Class<T> cls) Estimate the static space taken up by a class instance from cataloged coefficients.
| |
| estimateBaseFromCatalog | back to summary |
|---|---|
| private static int estimateBaseFromCatalog(Class<?> cls, boolean addToCatalog) | |
| estimateBaseFromCoefficients | back to summary |
|---|---|
| public static int estimateBaseFromCoefficients(int[] coeff) Estimate the static space taken up by a class instance given the coefficients returned by getSizeCoefficients.
| |
| estimateHashEntrySize | back to summary |
|---|---|
| public static int estimateHashEntrySize() Estimate the size of a Hashtable entry. In Java 1.2 we can use Map.entry, but this is not available in earlier versions of Java.
| |
| estimateMemoryUsage | back to summary |
|---|---|
| public static int estimateMemoryUsage(String str) Estimate the size of a string.
| |
| fetchRefSizeFromSystemProperties | back to summary |
|---|---|
| private static final int fetchRefSizeFromSystemProperties() Tries to determine the reference size in bytes by checking whether the VM we're running in is 32 or 64 bit by looking at the system properties.
| |
| getIntSize | back to summary |
|---|---|
public static int getIntSize()
| |
| getRefSize | back to summary |
|---|---|
| public static int getRefSize() Get the estimate of the size of an object reference.
| |
| getSizeCoefficients | back to summary |
|---|---|
| public static int[] getSizeCoefficients(Class<T> cl) The estimate of the size of a class instance depends on whether the JVM uses 32 or 64 bit addresses, that is it depends on the size of an object reference. It is a linear function of the size of a reference, e.g. 24 + 5*r where r is the size of a reference (usually 4 or 8 bytes). This method returns the coefficients of the linear function, e.g. {24, 5} in the above example.
| |
| getSystemProperty | back to summary |
|---|---|
| private static final String getSystemProperty(final String propName) Attempts to read the specified system property. | |
| runFinalization | back to summary |
|---|---|
| private static void runFinalization(Runtime runtime) This method exists merely to suppress the "removal" warning.
| |
| setDummyCatalog | back to summary |
|---|---|
| public static void setDummyCatalog() do not try to use the catalog. | |