diff options
author | 3gg <3gg@shellblade.net> | 2021-12-04 16:01:12 -0800 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2021-12-04 16:01:12 -0800 |
commit | f8217d240d598f39f70047f7a623dd46312542c6 (patch) | |
tree | 4e40843d665e388416c1226f739c2b8c0b8da736 /mempool/README.md | |
parent | 5f6ea503cdb6ad4a95b679672a1ad324d96c89a5 (diff) |
Initial commit.
Diffstat (limited to 'mempool/README.md')
-rw-r--r-- | mempool/README.md | 20 |
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 | |||
3 | A memory pool implementation. | ||
4 | |||
5 | Each block in the pool is tagged with a boolean value that indicates whether the | ||
6 | block is free or in use. The allocator otherwise maintains little additional | ||
7 | information. Therefore, some operations have linear-time complexity. | ||
8 | Specifically: | ||
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 | |||
15 | The allocator's internal data is also stored separately from the main array of | ||
16 | blocks so that the block data remains tightly packed. | ||
17 | |||
18 | For convenience of programming and debugging, free blocks in the mempool always | ||
19 | remain zeroed out. If your data structures are valid when zeroed out, then you | ||
20 | do not need to explicitly initialize them. | ||