From f99204184c8b96f499f6e7efbffb8b6b4ea8c93f Mon Sep 17 00:00:00 2001 From: 3gg <3gg@shellblade.net> Date: Tue, 1 Jul 2025 09:34:22 -0700 Subject: Add memstack --- memstack/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 memstack/README.md (limited to 'memstack/README.md') diff --git a/memstack/README.md b/memstack/README.md new file mode 100644 index 0000000..7eb950e --- /dev/null +++ b/memstack/README.md @@ -0,0 +1,15 @@ +# Mempool + +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, 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. + +The allocator's internal data is stored separately from the block data so that +the data remains tightly packed. + +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