#include <falcon/setup.h>
#include <falcon/globals.h>
#include <stdlib.h>
Go to the source code of this file.
Namespaces | |
namespace | Falcon |
CONST. | |
Functions | |
FALCON_DYN_SYM void * | Falcon::DflAccountMemAlloc (size_t amount) |
FALCON_DYN_SYM void | Falcon::DflAccountMemFree (void *mem) |
FALCON_DYN_SYM void * | Falcon::DflAccountMemRealloc (void *mem, size_t amount) |
FALCON_DYN_SYM void * | Falcon::DflMemAlloc (size_t amount) |
FALCON_DYN_SYM void | Falcon::DflMemFree (void *mem) |
FALCON_DYN_SYM void * | Falcon::DflMemRealloc (void *mem, size_t amount) |
FALCON_DYN_SYM void | Falcon::gcMemAccount (size_t memSize) |
Account allocated memory. | |
FALCON_DYN_SYM size_t | Falcon::gcMemAllocated () |
Return the total memory allocated by the GC system. | |
FALCON_DYN_SYM void | Falcon::gcMemShutdown () |
Call once Falcon is shut down. | |
FALCON_DYN_SYM void | Falcon::gcMemUnaccount (size_t memSize) |
Memory is alwas allocated via memAlloc() and released via memFree() function pointers. These are initially set at DflMemAlloc() and DflMemFree() functions, but they may be overridden with functions of the same kind at every point.
Falcon memory management is twofold: Memory used for internal storage (i.e. module loading, symbol tables, file names, configurations etc) is not accounted nor controlled, and never garbaged; the only control is during allocation and releasing via the basic functions, which print an error message and quit in case of allocation errors.
Items used by the VM (generated by scripts or returned to scripts by extensions) are created via the MemPool object; the memory allocated by this object is stored in the memory pool and may be garbaged, recycled or corrected.
In either case, Falcon never makes any assumption on the given memory. The embedding application may safely add any kind of memory management & accounting it likes.