Resource Tuner
|
#include <MemoryPool.h>
Public Member Functions | |
int32_t | makeAllocation (int32_t blockCount) |
Allocate memory for the specified type T. | |
void * | getBlock () |
Get an allocated block for the already allocated type T. | |
void | freeBlock (void *block) |
Free an allocated block of the specified type T. | |
Preallocate Memory for Commonly Used types, to decrease the Runtime Overhead of Memory Allocation and Deallocation System Calls while Processing Requests.
Definition at line 53 of file MemoryPool.h.
void MemoryPool::freeBlock | ( | void * | block | ) |
Free an allocated block of the specified type T.
block | Pointer to the block to be freed. |
void * MemoryPool::getBlock | ( | ) |
Get an allocated block for the already allocated type T.
This routine should only be called after the makeAllocation call for a particular type Note: If a block is not available then the Routine throws a std::bad_alloc exception.
int32_t MemoryPool::makeAllocation | ( | int32_t | blockCount | ) |
Allocate memory for the specified type T.
This routine will allocate the number of memory blocks for the type specified by the client.
blockCount | Number of blocks to be allocated. |