|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cornell.cs.sam.core.ExplicitFreeAllocator
public class ExplicitFreeAllocator
This allocator provides support for explicit malloc()/free() Expects heap size larger than Memory.UNIT_SIZE
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface edu.cornell.cs.sam.core.HeapAllocator |
---|
HeapAllocator.Allocation |
Constructor Summary | |
---|---|
ExplicitFreeAllocator()
|
Method Summary | |
---|---|
void |
free(int req_addr)
Frees the given position in memory, which must have been allocated with malloc() |
java.util.Iterator<HeapAllocator.Allocation> |
getAllocations()
Gets an iterator to the allocations on the heap |
Memory |
getMemory()
Gets the memory object of this allocator |
void |
init()
Resets any internal state in the heap allocator to initial state. |
void |
malloc(int req_size)
Allocates the specified amount of memory on the heap, and pushes its address on the stack. |
void |
setMemory(Memory mem)
Sets the memory object of this allocator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ExplicitFreeAllocator()
Method Detail |
---|
public Memory getMemory()
HeapAllocator
getMemory
in interface HeapAllocator
public void setMemory(Memory mem)
HeapAllocator
setMemory
in interface HeapAllocator
mem
- the memorypublic void init()
HeapAllocator
init
in interface HeapAllocator
public void malloc(int req_size) throws SystemException
HeapAllocator
malloc
in interface HeapAllocator
req_size
- the amount of memory to allocate
SystemException
- if there is an error allocating memorypublic void free(int req_addr) throws SystemException
HeapAllocator
free
in interface HeapAllocator
SystemException
- if there is an error freeing memorypublic java.util.Iterator<HeapAllocator.Allocation> getAllocations()
HeapAllocator
getAllocations
in interface HeapAllocator
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |