You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mecatui: stop the per-turn memory growth in blockRenderCache #2409
mecatui's RSS grows ~200 KB per turn and never comes back: 106 → 296 MiB over a 1,000-turn session (scripted, mock LLM, mecatui connect).
A heap profile at 0 / 100 / 300 turns attributes the growth to blockRenderCache (cmd/mecatui/ui/block_cache.go), which keeps an entry for every block in the conversation:
rendered[i]: the full rendered block plus provenance;
markdown[i]: the raw glamour output of the same block (~47 KB per assistant answer in the scenario). It's only needed to re-render a block, and a settled block re-renders only on width or expand changes;
prefixLines / prefixProvenance: the assembled settled frame, one more copy of every line.
Nothing is ever evicted except on a conversation rebuild.
Proposal
Drop markdown[i] once a block has settled. f9 or a resize re-runs glamour for that block. This roughly halves the growth (−47 KB/turn) and needs no other change.
With a virtualized transcript (perf(mecatui): profile long-transcript viewport replacement #1273), bound rendered to the blocks around the viewport (plus overscan), so settled blocks far from it are re-rendered on scroll-back. In the prototype, the heap stays flat at ~16 MiB, and RSS stays flat from 200 to 1,000 turns.
Acceptance
A long-session benchmark (≥ 500 turns) shows memory flat after warm-up.
f9 expand/collapse, resize, selection, and scroll-back render the same output as today (goldens).
Activity