#include <MemoryAllocator.h>
Public Member Functions | |
MemoryAllocator () | |
Constructor. | |
~MemoryAllocator () | |
Destructor. | |
int | Init (size_t nbytes) |
Initialises the allocator. Call it after instantiation (of course !) but before using any new operator. | |
Protected Member Functions | |
MemoryAllocator (const MemoryAllocator &ma) | |
Copy constructor. Should NOT be called. | |
MemoryAllocator & | operator= (const MemoryAllocator &ma) |
Affectation operator. Should NOT be called. | |
void * | Allocate (size_t nbytes) |
Allocates memory, used by operator new. | |
int | Release (void *pFrame) |
Releases memory, used by operator delete. | |
Protected Attributes | |
char * | m_MemoryBlock |
Memory block allocated by the class. | |
char * | m_BasePointer |
Memoy block's aligned base pointer. | |
char * | m_TopPointer |
Memoy block's aligned top pointer. | |
Friends | |
void * | operator new (size_t bytes, Moteur3D::MemoryAllocator &ma) |
void * | operator new (size_t bytes, Moteur3D::MemoryAllocator *ma) |
void | operator delete (void *p, Moteur3D::MemoryAllocator &ma) |
void | operator delete (void *p, Moteur3D::MemoryAllocator *ma) |
In order to use this allocator, you just have to use the following syntax : Foo f = new (ma) Foo(); where ma is an instance of MemoryAllocator.
Note that this class is still under developpment, for now you can only allocate and deallocate memory as if it was a stack, and the alignment is hard-coded as 16 bytes.
|
Constructor.
|
|
Destructor.
|
|
Copy constructor. Should NOT be called.
|
|
Allocates memory, used by operator new.
|
|
Initialises the allocator. Call it after instantiation (of course !) but before using any new operator.
|
|
Affectation operator. Should NOT be called.
|
|
Releases memory, used by operator delete.
|
|
|
|
|
|
|
|
|
|
Memoy block's aligned base pointer.
|
|
Memory block allocated by the class.
|
|
Memoy block's aligned top pointer.
|