Pool Class Reference

Public Member Functions

Private Member Functions

Private Attributes


Detailed Description

Memory pool for allocations of elements of a single fixed size. Memory is allocated from the OS in chunks, the pool grows in capacity as elements are allocated from it.


Constructor & Destructor Documentation

Pool::Pool ( size_t  elemsize,
size_t  block_size 
) [inline]

Allocates a pool with block_size elements of elemsize bytes each. The pool will grow in increments of block_size. Memory is NOT returned to the OS.

Pool::~Pool (  )  [inline]

References m_storage, and m_used.


Member Function Documentation

void* Pool::Allocate (  )  [inline]
void Pool::Deallocate ( void *  element  )  [inline]
size_t Pool::GetElemSize (  )  const [inline]
size_t Pool::GetSize (  )  const [inline]

References m_size.

size_t Pool::GetUsed (  )  const [inline]

References m_used.

template<typename T >
T* Pool::Construct (  )  [inline]

References Allocate().

template<typename T >
void Pool::Destroy ( T *  instance  )  [inline]

References Deallocate().

void Pool::AllocateNewBlock ( void   )  [inline, private]

References m_blocksize, m_elemsize, m_size, m_slots, m_storage, and m_used.

Referenced by Allocate().


Field Documentation

size_t Pool::m_elemsize [private]

Referenced by AllocateNewBlock(), and GetElemSize().

size_t Pool::m_blocksize [private]

Referenced by AllocateNewBlock().

size_t Pool::m_size [private]

Referenced by Allocate(), AllocateNewBlock(), and GetSize().

size_t Pool::m_used [private]
std::vector<char*> Pool::m_storage [private]

Referenced by AllocateNewBlock(), and ~Pool().

std::vector<void*> Pool::m_slots [private]

Generated on 4 Nov 2015 for CURE by  doxygen 1.6.1