public class ClassSize
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static int |
booleanSize |
private static int |
charSize |
private static int |
doubleSize |
private static boolean |
dummyCatalog |
private static int |
floatSize |
private static int |
intSize |
private static int |
longSize |
private static int |
minObjectSize |
(package private) static boolean |
noGuess |
private static int |
objectOverhead |
static int |
refSize |
private static int |
shortSize |
(package private) static boolean |
unitTest |
private static int[] |
wildGuess |
Constructor and Description |
---|
ClassSize() |
Modifier and Type | Method and Description |
---|---|
static int |
estimateAndCatalogBase(java.lang.Class cls)
Estimate the static space taken up by a class instance.
|
static int |
estimateArrayOverhead() |
static int |
estimateBase(java.lang.Class cl)
Estimate the static space taken up by the fields of a class.
|
static int |
estimateBaseFromCatalog(java.lang.Class cls)
Estimate the static space taken up by a class instance from cataloged coefficients.
|
private static int |
estimateBaseFromCatalog(java.lang.Class<?> cls,
boolean addToCatalog) |
static int |
estimateBaseFromCoefficients(int[] coeff)
Estimate the static space taken up by a class instance given the coefficients
returned by getSizeCoefficients.
|
static int |
estimateHashEntrySize()
Estimate the size of a Hashtable entry.
|
static int |
estimateMemoryUsage(java.lang.String str)
Estimate the size of a string.
|
private static 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.
|
static int |
getIntSize() |
static int |
getRefSize()
Get the estimate of the size of an object reference.
|
static int[] |
getSizeCoefficients(java.lang.Class 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 java.lang.String |
getSystemProperty(java.lang.String propName)
Attempts to read the specified system property.
|
static void |
setDummyCatalog()
do not try to use the catalog.
|
public static final int refSize
private static final int objectOverhead
private static final int booleanSize
private static final int charSize
private static final int shortSize
private static final int intSize
private static final int longSize
private static final int floatSize
private static final int doubleSize
private static final int minObjectSize
private static boolean dummyCatalog
static boolean noGuess
static boolean unitTest
private static final int[] wildGuess
public static void setDummyCatalog()
public static int getRefSize()
public static int getIntSize()
public static int[] getSizeCoefficients(java.lang.Class cl)
cl
- A class whose instance size is to be estimatedpublic static int estimateBaseFromCoefficients(int[] coeff)
coeff
- the coefficientspublic static int estimateBaseFromCatalog(java.lang.Class cls)
cls
- the classestimateBaseFromCoefficients(int[])
,
see org.apache.derbyBuild.ClassSizeCrawler
private static int estimateBaseFromCatalog(java.lang.Class<?> cls, boolean addToCatalog)
public static int estimateAndCatalogBase(java.lang.Class cls)
cls
- the classestimateBaseFromCoefficients(int[])
,
see org.apache.derbyBuild.ClassSizeCrawler
public static int estimateBase(java.lang.Class cl)
estimateBaseFromCatalog(java.lang.Class)
public static int estimateArrayOverhead()
public static int estimateHashEntrySize()
public static int estimateMemoryUsage(java.lang.String str)
private static final int fetchRefSizeFromSystemProperties()
-1
if the reference size couldn't be determined.private static final java.lang.String getSystemProperty(java.lang.String propName)
propName
- name of the system property to readnull
if it doesn't exist or the
required permission to read the property is missing.Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.