Issue #2856: A list pruned by swap_remove keeps every buffer to the end: SHEDS lacks it

Open and answer this issue on GitHub.

bug, ready · opened 2026-11-28 · updated 2026-11-28 · 0 comments

Found while “Does a frame or task keep holding buffers whose views died cost anything” (#2847), by its builder.

Probe

On develop 3c5592cd: tests/compiler/tests/a_frame_keep_holds_buffers_whose_views_died.nika with recent[i % 64] = w replaced by kept.push(w) and, once kept.len() > 64, kept.swap_remove(0).

Expected: like kept.remove(0), the list gets a keep per buffer (ADR-tether-v1 D12, a container that drops entries); peak memory about 0.29 MB (dhat). Actual: its buffers stay in the frame keep until main ends, 17.8 MB peak.

Cause

Traced: SHEDS in crates/nikaia-std/src/compiler/keep.nika (line 248) lacks "swap_remove", which TAKES (line 251) has.

To build

  1. Add "swap_remove" to SHEDS (the array’s length grows by one). Test: tests/compiler/tests/a_list_pruned_by_swap_remove_has_a_keep_per_buffer.nika, .stdout with its result, and in the commit message its dhat peak before and after.

Done when

The test passes and its peak is within 10 % of 0.29 MB; that commit carries Fixes #N.

Files and limits

keep.nika, its lowered file by lower-std.

Facts: Lowering and lower-std, Checker and views

Back to Open Issues