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
Fast efficient memory pools implementation supporting @nogc
and betterC
.
Note: Currently only fixedpool
is implemented.
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.
- Registered by Tomáš Chaloupka
- 0.1.0 released 5 years ago
- tchaloupka/mempooled
- BSL-1.0
- Copyright © 2019, Tomáš Chaloupka
- Authors:
- Dependencies:
- none
- Versions:
-
0.4.0 2023-May-20 0.3.1 2022-Jan-30 0.3.0 2021-Oct-19 0.2.0 2021-Sep-25 0.1.2 2019-Dec-07 - Download Stats:
-
-
47 downloads today
-
154 downloads this week
-
526 downloads this month
-
11601 downloads total
-
- Score:
- 3.0
- Short URL:
- mempooled.dub.pm