Elm
2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
|
#include <elm/alloc/GroupedGC.h>
Public Member Functions | |
GroupedGC (t::size size=4096) | |
virtual | ~GroupedGC (void) |
void | clear (void) |
void | doGC (void) |
virtual void * | allocate (t::size size) |
virtual bool | mark (void *data, t::size size) |
void | setDisableGC (bool b) |
Public Member Functions inherited from DefaultAllocator | |
void * | allocate (t::size size) |
void | free (void *block) |
virtual | ~DefaultAllocator () |
Protected Member Functions | |
virtual void | beginGC (void) |
virtual void | collect (void) |
virtual void | endGC (void) |
bool | getNeedGC (void) |
Additional Inherited Members | |
Static Public Attributes inherited from DefaultAllocator | |
static DefaultAllocator | DEFAULT |
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 elm::cout, GroupedGC::doGC(), and elm::io::endl.
Called before a GC starts. Overriding methods must call this one.
Referenced by GroupedGC::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 GroupedGC::doGC().
References GroupedGC::beginGC(), GroupedGC::collect(), elm::cout, GroupedGC::endGC(), and elm::io::endl.
Referenced by GroupedGC::allocate().
References elm::cerr, and elm::io::endl.
Referenced by GroupedGC::doGC().
Called to mark a block as alive.
data | Alive data block base. |
size | Size of block. |
Reimplemented from DefaultAllocator.
References elm::_, elm::cout, elm::io::endl, Tree< K, T, C >::get(), elm::io::hex(), and elm::io::p().