Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/alloc/SimpleGC.h>
Public Member Functions | |
SimpleGC (t::size size=4096) | |
virtual | ~SimpleGC (void) |
void | clear (void) |
void | doGC (void) |
void * | allocate (t::size size) |
void | free (void *block) |
Protected Member Functions | |
bool | mark (void *data, t::size size) |
virtual void | beginGC (void) |
virtual void | collect (void)=0 |
virtual void | endGC (void) |
Basically, this allocator is a stack allocator that support monitored reference collection for garbage collection. This means that the user is responsible to provide the live references at garbage collection time. This is done by overloading the collect() method and calling mark() on each live block.
Perform an allocation of the given size.
size | Size of allocated memory. |
References SimpleGC::doGC().
Called before a GC starts. Overriding methods must call this one.
Referenced by SimpleGC::doGC().
This function is called when references for a garbage collection are needed. It must call the mark() with each alive reference.
This function must be override in each use site in order to provide alive references.
Referenced by SimpleGC::doGC().
References DLNode::atEnd(), SimpleGC::beginGC(), SimpleGC::collect(), SimpleGC::endGC(), and DLList::first().
Referenced by SimpleGC::allocate().
Referenced by SimpleGC::doGC().
Called to mark a block as alive.
data | Alive data block base. |
size | Size of block. |
References elm::_, Tree< K, T, C >::get(), elm::io::hex(), and elm::io::p().