MemoryManager defines a basic interface for a custom memory manager to be uses by ARToolKitPlus. More...
#include <MemoryManager.h>
Public Member Functions | |
virtual bool | deinit ()=0 |
Releases all memory alloced previously. More... | |
virtual bool | didInit ()=0 |
Returns true if the MemoryManager was already initialized. More... | |
virtual unsigned int | getBytesAllocated ()=0 |
Returns the number of bytes allocated alltogether. More... | |
virtual void * | getMemory (size_t nNumBytes)=0 |
Reserves nNumBytes from previously allocated memory. More... | |
virtual bool | init (size_t nNumInitialBytes, size_t nNumGrowBytes=0)=0 |
The MemoryManager will allocate an initial amount of memory. More... | |
virtual void | releaseMemory (void *nMemoryBlock)=0 |
Releases a memory block that was allocated via getMemory() More... | |
virtual | ~MemoryManager () |
MemoryManager defines a basic interface for a custom memory manager to be uses by ARToolKitPlus.
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.
Definition at line 60 of file MemoryManager.h.
|
inlinevirtual |
Definition at line 63 of file MemoryManager.h.
|
pure virtual |
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().
|
pure virtual |
Returns true if the MemoryManager was already initialized.
|
pure virtual |
Returns the number of bytes allocated alltogether.
|
pure virtual |
Reserves nNumBytes from previously allocated memory.
init() hast to be called before getMemory can be invoked.
|
pure virtual |
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.
|
pure virtual |
Releases a memory block that was allocated via getMemory()