FixedPool

Implementation of "Fast Efficient Fixed-Size Memory Pool" as described in this article: www.thinkmind.org/download.php?articleid=computation_tools_2012_1_10_80006

Implementation of "Fast Efficient Fixed-Size Memory Pool" as described in this article.

It can work as a pool for single templated type or generic pool with a fixed block size (so one can alloc various types with size less or equal to the block size).

Minimal block size is 4B as data in blocks are used internally to form a linked list of the blocks.

Internally it uses refcounted payload so can be copied around as needed.

Constructors

this
this(typeof(this) rhs)

Copy constructor

Destructor

~this
~this()

Destructor

Members

Functions

alloc
U* alloc(ARGS args)

Allocates item of requested type from the pool.

alloc
T* alloc(ARGS args)

Allocates item from the pool.

capacity
size_t capacity()

Available number of items / blocks that can be allocated

dealloc
void dealloc(U* p)

Returns previously allocated item back to the pool.

dealloc
void dealloc(T* p)

Returns previously allocated item back to the pool.

Parameters

blockSize

size of one item block in a pool

T

optional forced type of pooled items - if used, pool is forced to provide items of this type only

See Also

Meta