From f8217d240d598f39f70047f7a623dd46312542c6 Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Sat, 4 Dec 2021 16:01:12 -0800 Subject: Initial commit. --- mempool/README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mempool/README.md (limited to 'mempool/README.md') 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 @@ +# Mempool + +A memory pool implementation. + +Each block in the pool is tagged with a boolean value that indicates whether the +block is free or in use. The allocator otherwise maintains little additional +information. Therefore, some operations have linear-time complexity. +Specifically: + +- Allocating a block scans the pool for the next free block in linear time. +- Freeing a block runs in constant time. +- Iterating over the pool's used blocks is linear over the number of blocks in + the pool, as opposed to just the number of used blocks. + +The allocator's internal data is also stored separately from the main array of +blocks so that the block data remains tightly packed. + +For convenience of programming and debugging, free blocks in the mempool always +remain zeroed out. If your data structures are valid when zeroed out, then you +do not need to explicitly initialize them. -- cgit v1.2.3