Skip to main content

Module heap

Module heap 

Source
Expand description

The heap: per-bin page queues, the small-size direct table, the generic (heartbeat) allocation path, and free (mirrors heap.c + the hot parts of alloc.c/page.c). Since M4 there is NO global lock: every thread owns its own heap, free routes by the segment’s owner id, and cross-thread frees go through the loom-modeled 4-state protocol in page.rs.

Structs§

AreaInfo
Area descriptor handed to block visitors (mirrors mi_heap_area_t).
Heap
The heap.
PageQueue
A doubly-linked queue of pages serving one bin.
Stats
Always-on counters (plan §7.5 instrument #2): the primary evidence for sub-1% bricks and the work-parity check for every A/B.

Constants§

MAX_DIRECT_BIN
Largest bin whose block size still fits the direct[] fast-path table.
MAX_NORMAL_BIN
Largest bin index actually reachable from a size (rest are M3 large pages).

Functions§

visit_segment_blocks
Visit every live page of ONE segment; optionally each allocated block. tag_filter >= 0 skips pages with a different heap tag. owner selects exact snapshots (collect) vs read-only walks (abandoned segments).