#include <MemoryManager.h>
Public Member Functions | |
virtual bool | init (size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0 |
The MemoryManager will allocate an initial amount of memory. | |
virtual bool | deinit ()=0 |
Releases all memory alloced previously. | |
virtual bool | didInit ()=0 |
Returns true if the MemoryManager was already initialized. | |
virtual void * | getMemory (size_t nNumBytes)=0 |
Reserves nNumBytes from previously allocated memory. | |
virtual void | releaseMemory (void *nMemoryBlock)=0 |
Releases a memory block that was allocated via getMemory(). | |
virtual unsigned int | getBytesAllocated ()=0 |
Returns the number of bytes allocated alltogether. |
In various situations it makes sense to have a custom memory manager rather than using the default new/delete functions provided by the c-runtime. To use a custom memory manager it has to be set using ARToolKitPlus::setMemoryManager() before ARToolKitPlus is instantiated. If no memory manager is set, ARToolKitPlus will use the default new/delete functions.
|
Releases all memory alloced previously. After deinit() has been called getMemory() will not be able to reserve memory anymore. deinit( ) releases all memory allocated previously. It is not required to call releaseMemory() after deinit(). |
|
Reserves nNumBytes from previously allocated memory. init() hast to be called before getMemory can be invoked. |
|
The MemoryManager will allocate an initial amount of memory. Each time the MemoryManager does not have enough memory left for a getMemory() request it will allocate another block of nNumGrowBytes bytes. |