SST  11.1.0
StructuralSimulationToolkit
SST::Core::MemPool Class Reference

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.
 

Detailed Description

Simple Memory Pool class.

Constructor & Destructor Documentation

SST::Core::MemPool::MemPool ( size_t  elementSize,
size_t  initialSize = (2 << 20) 
)
inline

Create a new Memory Pool.

Parameters
elementSize- Size of each Element
initialSize- Size of the memory pool (in bytes)

Member Function Documentation

uint64_t SST::Core::MemPool::getBytesMemUsed ( )
inline

Approximates the current memory usage of the mempool.

Some overheads are not taken into account.


The documentation for this class was generated from the following file: