The census's native line is malloc's live bytes over every zone since judging began less what Ludic's tracked blocks kept - the libraries' and drivers' growth, read before the census file is opened. A tracked block counts malloc_size(), not the size asked for, so kept is what the heap pays and the residual carries no rounding. @malloc_zone_statistics is declared once, by the fence or by Os.heap_bytes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
623 B
Text
17 lines
623 B
Text
# alloc_fence_leak.ludic - frame 50 keeps one record in a list that outlives it. The fence fails
|
|
# the run there (exit 86) and names this file's `new Box` line; under R3D_ALLOC_FENCE=count it
|
|
# runs on and prints `kept 80 bad 1` (the record and the list's growth, at malloc's own sizes, in one frame).
|
|
program AllocFenceLeak {
|
|
property Box { a: int = 0, b: int = 0 }
|
|
entry {
|
|
var held = new []Box
|
|
Mem.play()
|
|
Mem.settled()
|
|
for f in 0 .. 100 {
|
|
if f == 50 { push(held, new Box { a: f }) }
|
|
Mem.frame()
|
|
}
|
|
let kept_now = Mem.kept()
|
|
print(`kept {kept_now} bad {Mem.bad_frames()}`)
|
|
}
|
|
}
|