#include "clib.h"
Go to the source code of this file.
Defines | |
#define | JAUNE_GC_H 1 |
#define | Alloc(_a) __Alloc(_a) |
Functions | |
void | InitHeap (void *pBase, UINT uSize) |
Initialise the heap to use the given memory block. More... | |
void * | __Alloc (UINT uSize) |
Attempt to allocate a block of memory out of the heap, returning NULL if there is insufficent space. More... | |
void * | GrowAlloc (void *p, UINT uNewSize) |
Grows the previousally allocated buffer, copying if the block can't be grown in place. More... | |
void | Free (void *p) |
Frees a previousally allocated block. More... | |
UINT | GetAvailableHeap (void) |
Returns a rough estimate of the available heap space. More... | |
UINT | RunGarbageCollectorInt (void **pStack, UINT nInStack, void **pStatic, UINT nInStatic) |
Runs the garbage collector using the given data as the root set. More... | |
UINT | RunGarbageCollector (void) |
void | SetupGarbageCollector (UINT16 *pTopOfStack, void **pStatics, UINT nInStatic) |
void | DumpHeapState (void) |
Dumps the heap state to stdout. |
|
Attempt to allocate a block of memory out of the heap, returning NULL if there is insufficent space. Zeros the returned block. |
|
Frees a previousally allocated block. Will fail if the passed in pointer is invalid. |
|
Returns a rough estimate of the available heap space. Returns the sum of all free space, which may not be contigious and allocatable. |
|
Grows the previousally allocated buffer, copying if the block can't be grown in place. Zeros the new area.
|
|
Initialise the heap to use the given memory block. Completely resets the heap. Note that the total free space will be less than that fed in due to the headers. |
|
Runs the garbage collector using the given data as the root set. Returns the number of blocks that were returned to the free pool. The root set is made up of the stack and the static data. The system assumes that both the static data and stack are pointer alligned. For example, on the z80 you cannot store a byte as a byte on the stack, as this will skew the remainder of the stack.
|