aboutsummaryrefslogtreecommitdiff
path: root/mempool/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'mempool/README.md')
-rw-r--r--mempool/README.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/mempool/README.md b/mempool/README.md
new file mode 100644
index 0000000..ed2935e
--- /dev/null
+++ b/mempool/README.md
@@ -0,0 +1,20 @@
1# Mempool
2
3A memory pool implementation.
4
5Each block in the pool is tagged with a boolean value that indicates whether the
6block is free or in use. The allocator otherwise maintains little additional
7information. Therefore, some operations have linear-time complexity.
8Specifically:
9
10- Allocating a block scans the pool for the next free block in linear time.
11- Freeing a block runs in constant time.
12- Iterating over the pool's used blocks is linear over the number of blocks in
13 the pool, as opposed to just the number of used blocks.
14
15The allocator's internal data is also stored separately from the main array of
16blocks so that the block data remains tightly packed.
17
18For convenience of programming and debugging, free blocks in the mempool always
19remain zeroed out. If your data structures are valid when zeroed out, then you
20do not need to explicitly initialize them.