Simple Memory Pool class. More...
#include <mempool.h>
Public Member Functions | |
MemPool (size_t elementSize, size_t initialSize=(2<< 20)) | |
Create a new Memory Pool. | |
void * | malloc () |
Allocate a new element from the memory pool. | |
void | free (void *ptr) |
Return an element to the memory pool. | |
uint64_t | getBytesMemUsed () |
Approximates the current memory usage of the mempool. | |
uint64_t | getUndeletedEntries () |
size_t | getArenaSize () const |
size_t | getElementSize () const |
const std::list< uint8_t * > & | getArenas () |
Data Fields | |
uint64_t | numAlloc |
Counter: Number of times elements have been allocated. | |
uint64_t | numFree |
Counter: Number times elements have been freed. |
Simple Memory Pool class.
SST::Core::MemPool::MemPool | ( | size_t | elementSize, | |
size_t | initialSize = (2<<20) | |||
) | [inline] |
Create a new Memory Pool.
elementSize | - Size of each Element | |
initialSize | - Size of the memory pool (in bytes) |
uint64_t SST::Core::MemPool::getBytesMemUsed | ( | ) | [inline] |
Approximates the current memory usage of the mempool.
Some overheads are not taken into account.