aboutsummaryrefslogtreecommitdiff
path: root/mempool/README.md
blob: 7eb950e75ea443a2bfd6265b2149be65a4397fc8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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.