dune-common 2.1.1
|
A memory pool of objects. More...
#include <dune/common/poolallocator.hh>
Classes | |
struct | Chunk |
Chunk of memory managed by the pool. | |
struct | Reference |
Reference to next free element. | |
Public Types | |
enum | { unionSize, size, alignment = Lcm<AlignmentOf<MemberType>::value, value, alignedSize, chunkSize, elements = ((chunkSize - alignment + 1)/ alignedSize) } |
typedef T | MemberType |
The type of object we allocate memory for. | |
Public Member Functions | |
Pool () | |
Constructor. | |
~Pool () | |
Destructor. | |
void * | allocate () |
Get a new or recycled object. | |
void | free (void *o) |
Free an object. | |
void | print (std::ostream &os) |
Print elements in pool for debugging. | |
Friends | |
struct | ::testPoolMain< s, T > |
class | PoolAllocator |
A memory pool of objects.
The memory for the objects is organized in chunks. Each chunks is capable of holding a specified number of objects. The allocated objects will be properly aligned for fast access. Deallocated objects are cached for reuse to prevent memory fragmentation.
T | The type that is allocated by us. |
s | The size of a memory chunk in bytes. |
typedef T Dune::Pool< T, s >::MemberType |
The type of object we allocate memory for.
anonymous enum |
friend struct ::testPoolMain< s, T > [friend] |
friend class PoolAllocator [friend] |