IRC_SERVER
By @hyunjunk (hyunjun2372@gmail.com)
|
Memory pool that can allocate fixed amount of data. More...
#include <FixedMemoryPool.hpp>
Public Member Functions | |
FixedMemoryPool () | |
~FixedMemoryPool () | |
T * | Allocate () |
Allocate a data. | |
void | Deallocate (T *ptr) |
Deallocate a data. | |
bool | IsCapacityFull () const |
bool | IsInPool (const void *ptr) const |
size_t | GetUsed () const |
size_t | GetCapacity () const |
Private Types | |
enum | { CAPACITY = MemoryPageCapacity * PAGE_SIZE / sizeof(T) } |
Private Attributes | |
size_t | mCapacity |
size_t | mIndices [CAPACITY] |
size_t | mCursor |
char * | mMemoryRaw |
Memory pool that can allocate fixed amount of data.
Allocates raw memory on a per-page basis ( see PAGE_SIZE ), and manages data there. Also uses an index array filled sequentially from 1 to N, and a corresponding cursor to identify allocatable data.
T | Type of data to allocate |
MemoryPageCapacity | Number of pages to allocate. (see details) |
|
inline |
|
inline |
|
inline |
Allocate a data.
|
inline |
Deallocate a data.
ptr | Pointer to the data to deallocate |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |