render3d: a stream's cache is made with the stream - records and an arena - and evicts in place

stream_update made a Chunk and a words copy per new chunk (fn_stream_update +39 blocks / 13.2 KB a
window with the hiker in the drifting boat). The pool holds STREAM_MAX_CHUNKS records; the arena
is twice the layer's cap; eviction compacts it; a chunk that cannot be kept is gathered from the
scratch. stream_clear_all frees records, lists and streams. steady: 300 new cells, cap 256: 156 KB
before, 0 / -4.9 KB after, and every kept chunk's data checked against its cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-28 13:26:59 +03:00
parent b4774a46ee
commit 7e9fa4473c
4 changed files with 99 additions and 19 deletions

9
changes/stream-arena.md Normal file
View file

@ -0,0 +1,9 @@
bump: patch
type: fix
**Streaming new ground allocates nothing.** A streamed layer's cache made a record and a copy of
its instances for every chunk the camera found, so the heap grew for as long as there was ground
nobody had stood near - a boat drifting across the lake grew it every frame it crossed a cell. Each
stream now makes its whole cache when it is created: a record per chunk it can keep and an arena of
twice what its layer draws, compacted in place when it evicts. Replacing the world
(`stream_clear_all`) now gives every record, list and stream back. `examples/rendering/steady.ludic`
crosses 300 new cells with eviction running: 156 KB before, 0 after, every kept chunk still its own.