mempooled 0.1.0

Mempool implementation for dlang


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

mempooled

Latest version Dub downloads Build status codecov license

Fast efficient memory pools implementation supporting @nogc and betterC.

Note: Currently only fixedpool is implemented.

Docs

fixedpool

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 - note however that space can be used inefficiently as one pool block can hold only one such item).

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

Sample usage

import mempooled.fixed;

struct Foo {}

auto pool = fixedPool!(Foo, 10);
Foo* f = pool.alloc();

// some work

pool.dealloc(f);
f = null;

or with a generic pool:

import mempooled.fixed;

struct Foo
{
    int f;
    this(int f) { this.f = f; }
}
struct Bar {}

auto pool = fixedPool!(32, 100);
Foo* f = pool.alloc!Foo(42);
Bar* b = pool.alloc!Bar();
pool.dealloc(f);
pool.dealloc(b);

How to use the lib

Add it as a dependency to your dub project type or just copy the source code to your project.

Authors:
  • Tomáš Chaloupka
Dependencies:
none
Versions:
0.1.2 2019-Dec-07
0.1.1 2019-Dec-07
0.1.0 2019-Dec-06
~master 2019-Dec-07
Show all 4 versions
Download Stats:
  • 10 downloads today

  • 58 downloads this week

  • 157 downloads this month

  • 2012 downloads total

Score:
1.3
Short URL:
mempooled.dub.pm