#include <PionPoolAllocator.hpp>
Definition at line 48 of file PionPoolAllocator.hpp.
Public Member Functions | |
virtual | ~PionPoolAllocator () |
virtual destructor | |
PionPoolAllocator (void) | |
default constructor | |
void * | malloc (std::size_t n) |
void | free (void *ptr, std::size_t n) |
bool | release_memory (void) |
Protected Types | |
typedef void * | FreeListPtr |
NumberOfAllocs = ((MaxSize-1) / MinSize) + 1 | |
enum | { NumberOfAllocs = ((MaxSize-1) / MinSize) + 1 } |
constant representing the number of fixed-size pool allocators | |
Protected Member Functions | |
BOOST_STATIC_ASSERT (MaxSize >=MinSize) | |
BOOST_STATIC_ASSERT (MaxSize%MinSize==0) | |
FixedSizeAlloc * | getPool (const std::size_t n) |
Classes | |
struct | FixedSizeAlloc |
pion::PionPoolAllocator< MinSize, MaxSize >::BOOST_STATIC_ASSERT | ( | MaxSize >= | MinSize | ) | [protected] |
ensure that: a) MaxSize >= MinSize b) MaxSize is a multiple of MinSize c) MinSize >= sizeof(FreeNodePtr) [usually 16]
void pion::PionPoolAllocator< MinSize, MaxSize >::free | ( | void * | ptr, | |
std::size_t | n | |||
) | [inline] |
deallocates a block of memory
ptr | raw pointer to the block of memory | |
n | requested size of the memory block, in bytes (actual size may be larger) |
Definition at line 102 of file PionPoolAllocator.hpp.
References pion::PionPoolAllocator< MinSize, MaxSize >::getPool(), pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_free_ptr, pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_mutex, and pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_pool.
FixedSizeAlloc* pion::PionPoolAllocator< MinSize, MaxSize >::getPool | ( | const std::size_t | n | ) | [inline, protected] |
gets an appropriate fixed-size pool allocator
n | the number of bytes to be (de)allocated |
Definition at line 210 of file PionPoolAllocator.hpp.
Referenced by pion::PionPoolAllocator< MinSize, MaxSize >::free(), and pion::PionPoolAllocator< MinSize, MaxSize >::malloc().
void* pion::PionPoolAllocator< MinSize, MaxSize >::malloc | ( | std::size_t | n | ) | [inline] |
allocates a block of memory
n | minimum size of the new memory block, in bytes |
Definition at line 72 of file PionPoolAllocator.hpp.
References pion::PionPoolAllocator< MinSize, MaxSize >::getPool(), pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_free_ptr, pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_mutex, and pion::PionPoolAllocator< MinSize, MaxSize >::FixedSizeAlloc::m_pool.
bool pion::PionPoolAllocator< MinSize, MaxSize >::release_memory | ( | void | ) | [inline] |
releases every memory block that does not have any allocated chunks
bool | true if at least one block of memory was released |
Definition at line 135 of file PionPoolAllocator.hpp.