Dura2D
v0.1.0
An educational 2D game physics library
|
The d2BlockAllocator class is responsible for managing memory allocation and deallocation. It maintains a list of free blocks of different sizes, and can allocate and deallocate blocks of memory. More...
#include <d2BlockAllocator.h>
Public Member Functions | |
d2BlockAllocator () | |
Default constructor. | |
~d2BlockAllocator () | |
Destructor. | |
void * | Allocate (int32 size) |
Allocates a block of memory of the specified size. | |
void | Free (void *p, int32 size) |
Frees a block of memory. | |
void | Clear () |
Clears all allocated blocks. | |
The d2BlockAllocator class is responsible for managing memory allocation and deallocation. It maintains a list of free blocks of different sizes, and can allocate and deallocate blocks of memory.
d2BlockAllocator::d2BlockAllocator | ( | ) |
Default constructor.
d2BlockAllocator::~d2BlockAllocator | ( | ) |
Destructor.
void * d2BlockAllocator::Allocate | ( | int32 | size | ) |
Allocates a block of memory of the specified size.
size | The size of the block to allocate |
void d2BlockAllocator::Clear | ( | ) |
Clears all allocated blocks.
void d2BlockAllocator::Free | ( | void * | p, |
int32 | size ) |
Frees a block of memory.
p | A pointer to the block to free |
size | The size of the block to free |