From b48f99a40b1a58c02ccbcb75bc18a158294c356f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Mon, 30 Jun 2025 18:51:17 -0700 Subject: Update README --- mempool/README.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/mempool/README.md b/mempool/README.md index ed2935e..7eb950e 100644 --- a/mempool/README.md +++ b/mempool/README.md @@ -1,20 +1,15 @@ # Mempool -A memory pool implementation. +A memory pool of fixed-sized blocks with O(1) allocation and deallocation. 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: +block is free or in use, as well as a pointer to the next free/used block. +Blocks thus form two lists, a free list and a used list. The allocator +maintains the two lists when allocating/deallocating blocks. -- 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 stored separately from the block data so that +the data remains tightly packed. -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. +Free blocks in the mempool always remain zeroed out for convenience of +programming and debugging. If the application's data structures are valid when +zeroed out, then they do not need to be explicitly initialized. -- cgit v1.2.3