SST
9.0.0
StructuralSimulationToolkit
|
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. More... | |
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. More... | |
uint64_t | getUndeletedEntries () |
size_t | getArenaSize () const |
size_t | getElementSize () const |
const std::list< uint8_t * > & | getArenas () |
Data Fields | |
std::atomic< uint64_t > | numAlloc |
Counter: Number of times elements have been allocated. | |
std::atomic< uint64_t > | numFree |
Counter: Number times elements have been freed. | |
Simple Memory Pool class.
|
inline |
Create a new Memory Pool.
elementSize | - Size of each Element |
initialSize | - Size of the memory pool (in bytes) |
|
inline |
Approximates the current memory usage of the mempool.
Some overheads are not taken into account.