|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.deegree.commons.utils.memory.AllocatedHeapMemory
public class AllocatedHeapMemory
The AllocatedHeapMemory
class provides methods for calculating the heap memory for some primitive
objects.
Field Summary | |
---|---|
static int |
DOUBLE_SIZE
Number of bytes for a float |
static int |
FLOAT_SIZE
Number of bytes for a float |
static int |
INSTANCE_SIZE
The number of bytes a simple new Object without any fields will consume. |
static int |
INT_SIZE
Number of bytes for an int |
static int |
LONG_SIZE
Number of bytes for an int |
static int |
REF_SIZE
The number of bytes a reference will have |
Constructor Summary | |
---|---|
AllocatedHeapMemory()
|
Method Summary | |
---|---|
static int |
instanceAndReferenceSize(boolean asReference)
This will return the size of an instance of a new Object, if the asReference is true, the size of a reference will be added as well. |
static long |
roundToMem(long currentSize)
The JVM allocates 8 bytes at a time.. |
static long |
sizeOfBuffer(Buffer b,
boolean asReference)
|
static long |
sizeOfByteArray(byte[] o,
boolean asReference)
|
static long |
sizeOfDoubleArray(double[] o,
boolean asReference)
|
static long |
sizeOfFloatArray(float[] o,
boolean asReference)
|
static long |
sizeOfIntArray(int[] o,
boolean asReference)
|
static long |
sizeOfList(List<?> l,
boolean asReference)
The size of the Objects referenced in the list are not accounted for. |
static long |
sizeOfLongArray(int[] o,
boolean asReference)
|
static long |
sizeOfObjectArray(Object[] o,
boolean asReference)
|
static long |
sizeOfString(String s,
boolean asReference,
boolean internalised)
The approximate size of the given String Object in bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int REF_SIZE
public static final int INSTANCE_SIZE
public static final int INT_SIZE
public static final int LONG_SIZE
public static final int FLOAT_SIZE
public static final int DOUBLE_SIZE
Constructor Detail |
---|
public AllocatedHeapMemory()
Method Detail |
---|
public static final int instanceAndReferenceSize(boolean asReference)
asReference
-
public static final long roundToMem(long currentSize)
currentSize
- of the object
public static long sizeOfString(String s, boolean asReference, boolean internalised)
s
- to checkasReference
- true if the String is a reference inside another class (if the size of a reference should be added).internalised
- the resulting string will not be internalised, for example if a StringBuilder is used.
public static long sizeOfObjectArray(Object[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfFloatArray(float[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfDoubleArray(double[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfByteArray(byte[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfIntArray(int[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfLongArray(int[] o, boolean asReference)
o
- asReference
- true if the array is a reference inside another class (if the size of a reference should be added).
public static long sizeOfList(List<?> l, boolean asReference)
l
- get the bytes for.asReference
- true if the list is a reference inside another class (if the size of a reference should be added)
public static long sizeOfBuffer(Buffer b, boolean asReference)
b
- asReference
- true if the buffer is a reference inside another class (if the size of a reference should be added)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |