|
dune-common 2.9.0
|
A memory pool of objects. More...
#include <dune/common/poolallocator.hh>

Public Types | |
| typedef T | MemberType |
| The type of object we allocate memory for. More... | |
Public Member Functions | |
| Pool () | |
| Constructor. More... | |
| ~Pool () | |
| Destructor. More... | |
| void * | allocate () |
| Get a new or recycled object. More... | |
| void | free (void *o) |
| Free an object. More... | |
| void | print (std::ostream &os) |
| Print elements in pool for debugging. More... | |
Static Public Attributes | |
| static constexpr int | unionSize |
| The size of a union of Reference and MemberType. More... | |
| static constexpr int | size |
| Size requirement. At least one object has to stored. More... | |
| static constexpr int | alignment = std::lcm(alignof(MemberType), alignof(Reference)) |
| The alignment that suits both the MemberType and the Reference (i.e. their least common multiple). More... | |
| static constexpr int | alignedSize |
| The aligned size of the type. More... | |
| static constexpr int | chunkSize |
| The size of each chunk memory chunk. More... | |
| static constexpr int | elements = (chunkSize / alignedSize) |
| The number of element each chunk can hold. More... | |
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.
|
staticconstexpr |
The aligned size of the type.
This size is bigger than sizeof of the type and a multiple of the alignment requirement.
|
staticconstexpr |
The alignment that suits both the MemberType and the Reference (i.e. their least common multiple).
|
staticconstexpr |
|
staticconstexpr |
The number of element each chunk can hold.
|
staticconstexpr |
|
staticconstexpr |
The size of a union of Reference and MemberType.