diff options
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. | ||