Issue #2379: A program counts its allocations only where it reads the counts or sets a budget

Open and answer this issue on GitHub.

runtime, performance, decision · opened 2026-11-20 · updated 2026-11-20 · 0 comments

Found while a Counting global allocator in the nikaia binary costs +4.2 % instructions (#2368) Part of std::mem: allocations() and usage() per thread (ADR-400) (#2112)

Goal

A program pays for counting its allocations only where it reads the counts. Today every emitted program and (with #2368) the nikaia binary installs task_block::Counting (crates/unsafe/task-block/src/lib.rs), which on every alloc, dealloc and realloc adds to the thread’s TALLY (ADR-400 D1, D2) and to the running block’s outside (ADR-327 D9, D10).

Measured (callgrind, a compile of tests/compiler/tests/byteset_every_search_is_the_byte_by_byte_one.nika)

To decide

Done when

A program that reads no counts and sets no budget runs with the system allocator (instruction count equal to it, measured), and one that reads them still gets ADR-400’s numbers (tests/compiler/tests/ test).

Back to Open Issues