|
|||||||||
| Home >> All >> [ Allocator overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
Allocator
Class SimpleAllocator

java.lang.ObjectAllocator.HeapAllocator
Allocator.SimpleAllocator
- All Implemented Interfaces:
- Clazz.jq_ClassFileConstants
- public class SimpleAllocator
- extends HeapAllocator
SimpleAllocator
- Version:
- $Id: SimpleAllocator.java,v 1.30 2003/05/12 10:04:52 joewhaley Exp $
| Nested Class Summary |
| Nested classes inherited from class Allocator.HeapAllocator |
HeapAllocator.HeapPointer |
| Field Summary | |
static Clazz.jq_InstanceMethod |
_allocateArray
|
static Clazz.jq_InstanceMethod |
_allocateArrayAlign8
|
static Clazz.jq_InstanceMethod |
_allocateObject
|
static Clazz.jq_InstanceMethod |
_allocateObjectAlign8
|
static Clazz.jq_Class |
_class
|
static int |
BLOCK_SIZE
Size of blocks allocated from the OS. |
private GC.GCBits |
gcBits
GC information for the current block. |
private Memory.HeapAddress |
heapCurrent
Pointers to the start, current, and end of the heap. |
private Memory.HeapAddress |
heapEnd
Pointers to the start, current, and end of the heap. |
private Memory.HeapAddress |
heapFirst
Pointers to the start, current, and end of the heap. |
static int |
LARGE_THRESHOLD
Threshold for direct OS allocation. |
static int |
MAX_MEMORY
Maximum memory, in bytes, to be allocated from the OS. |
| Fields inherited from class Allocator.HeapAllocator |
_clsinitAndAllocateObject |
| Constructor Summary | |
SimpleAllocator()
|
|
| Method Summary | |
java.lang.Object |
allocateArray(int length,
int size,
java.lang.Object vtable)
Allocate an array with the default alignment. |
java.lang.Object |
allocateArrayAlign8(int length,
int size,
java.lang.Object vtable)
Allocate an array such that the elements are 8-byte aligned. |
private void |
allocateNewBlock()
Allocates a new block of memory from the OS, sets the current block to point to it, makes the new block the current block, and allocates and installs the GC structures. |
java.lang.Object |
allocateObject(int size,
java.lang.Object vtable)
Allocate an object with the default alignment. |
java.lang.Object |
allocateObjectAlign8(int size,
java.lang.Object vtable)
Allocate an object such that the first field is 8-byte aligned. |
void |
collect()
Initiate a garbage collection. |
int |
freeMemory()
Returns an estimate of the amount of free memory available. |
void |
init()
Perform initialization for this allocator. |
private void |
installGCBits()
Allocates and installs the GC structures for the current block. |
void |
processPtrField(Memory.Address a)
Process a reference to a heap object during garbage collection. |
int |
totalMemory()
Returns an estimate of the total memory allocated (both used and unused). |
| Methods inherited from class Allocator.HeapAllocator |
clone, clsinitAndAllocateObject, heapExhausted, outOfMemory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
BLOCK_SIZE
public static final int BLOCK_SIZE
- Size of blocks allocated from the OS.
- See Also:
- Constant Field Values
MAX_MEMORY
public static int MAX_MEMORY
- Maximum memory, in bytes, to be allocated from the OS.
LARGE_THRESHOLD
public static final int LARGE_THRESHOLD
- Threshold for direct OS allocation. When an array overflows the current block
and is larger than this size, it is allocated directly from the OS.
- See Also:
- Constant Field Values
heapFirst
private Memory.HeapAddress heapFirst
- Pointers to the start, current, and end of the heap.
heapCurrent
private Memory.HeapAddress heapCurrent
- Pointers to the start, current, and end of the heap.
heapEnd
private Memory.HeapAddress heapEnd
- Pointers to the start, current, and end of the heap.
gcBits
private GC.GCBits gcBits
- GC information for the current block.
_class
public static final Clazz.jq_Class _class
_allocateObject
public static final Clazz.jq_InstanceMethod _allocateObject
_allocateObjectAlign8
public static final Clazz.jq_InstanceMethod _allocateObjectAlign8
_allocateArray
public static final Clazz.jq_InstanceMethod _allocateArray
_allocateArrayAlign8
public static final Clazz.jq_InstanceMethod _allocateArrayAlign8
| Constructor Detail |
SimpleAllocator
public SimpleAllocator()
| Method Detail |
init
public final void init()
throws java.lang.OutOfMemoryError
- Perform initialization for this allocator. This will be called before any other methods.
This allocates an initial block of memory from the OS and sets up relevant pointers.
- Specified by:
initin classHeapAllocator
allocateNewBlock
private void allocateNewBlock()
- Allocates a new block of memory from the OS, sets the current block to
point to it, makes the new block the current block, and allocates and
installs the GC structures.
installGCBits
private void installGCBits()
- Allocates and installs the GC structures for the current block.
freeMemory
public final int freeMemory()
- Returns an estimate of the amount of free memory available.
- Specified by:
freeMemoryin classHeapAllocator
totalMemory
public final int totalMemory()
- Returns an estimate of the total memory allocated (both used and unused).
- Specified by:
totalMemoryin classHeapAllocator
allocateObject
public final java.lang.Object allocateObject(int size, java.lang.Object vtable) throws java.lang.OutOfMemoryError
- Allocate an object with the default alignment.
If the object cannot be allocated due to lack of memory, throws OutOfMemoryError.
- Specified by:
allocateObjectin classHeapAllocator
allocateObjectAlign8
public final java.lang.Object allocateObjectAlign8(int size, java.lang.Object vtable) throws java.lang.OutOfMemoryError
- Allocate an object such that the first field is 8-byte aligned.
If the object cannot be allocated due to lack of memory, throws OutOfMemoryError.
- Specified by:
allocateObjectAlign8in classHeapAllocator
allocateArray
public final java.lang.Object allocateArray(int length, int size, java.lang.Object vtable) throws java.lang.OutOfMemoryError, java.lang.NegativeArraySizeException
- Allocate an array with the default alignment.
If length is negative, throws NegativeArraySizeException.
If the array cannot be allocated due to lack of memory, throws OutOfMemoryError.
- Specified by:
allocateArrayin classHeapAllocator
allocateArrayAlign8
public final java.lang.Object allocateArrayAlign8(int length, int size, java.lang.Object vtable) throws java.lang.OutOfMemoryError, java.lang.NegativeArraySizeException
- Allocate an array such that the elements are 8-byte aligned.
If length is negative, throws NegativeArraySizeException.
If the array cannot be allocated due to lack of memory, throws OutOfMemoryError.
- Specified by:
allocateArrayAlign8in classHeapAllocator
collect
public final void collect()
- Description copied from class:
HeapAllocator - Initiate a garbage collection.
- Specified by:
collectin classHeapAllocator
processPtrField
public final void processPtrField(Memory.Address a)
- Description copied from class:
HeapAllocator - Process a reference to a heap object during garbage collection.
- Specified by:
processPtrFieldin classHeapAllocator
|
|||||||||
| Home >> All >> [ Allocator overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC