From 685a7b3456185c39e7813c3c69ab0b346daf9e1f Mon Sep 17 00:00:00 2001 From: Taylan Kammer Date: Tue, 22 Sep 2026 06:21:48 +0200 Subject: Amend latest note. --- notes/260922-use-alloc-3.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'notes') diff --git a/notes/260922-use-alloc-3.md b/notes/260922-use-alloc-3.md index 9ca98f7..abe520d 100644 --- a/notes/260922-use-alloc-3.md +++ b/notes/260922-use-alloc-3.md @@ -65,13 +65,17 @@ Block Alloc, with the following collection strategy: phase (bit was set in original) but have been found not to be live anymore (bit not set in new). -* If an entire block comes out empty, we can release it directly back - to Meta Alloc. Otherwise, we perform a `free()` on individual "now - dead" memory slots which does something similar to Block Alloc, but - freeing directly to the shared free-list of the appropriate size - class, instead of thread-local caches. The mutator threads have - thread-local caches anyway, filled from the global free-list in - chunks, as an optimization. +* If a block was completely full, but is now completely empty, we can + free it back to Meta Alloc. (If only some slots were occupied and + now the whole block is empty, we can't free it, since some of its + unoccupied slots may be in a free-list.) + +* Otherwise, we `free()` individual "now dead" memory slots in it, + which works similarly to the `free()` of Block Alloc, but putting + the slots directly into the shared free-list of the size class, in + chunks to decrease contention. (Mutator threads have thread-local + caches anyway, filled from the global free-list in chunks, as an + optimization.) * We need a way to identify what size class a block is for. Remember that the blocks supporting multiple size classes use a `u32` but -- cgit v1.2.3