File: src/grid.zig:245-257
Severity: HIGH
Status: Fixed
scrollUp correctly caps live history at history_limit, but every eviction
calls line.deinit(self.allocator) where self.allocator is the session
arena — ArenaAllocator.free is a no-op for any non-most-recent allocation.
The session’s memory footprint grows in proportion to all terminal output
ever produced, not to the configured scrollback.
Grid (and its lines) allocate from the session arena by design; there is no mechanism to release individual lines.
Give Grid.history a dedicated resettable arena (reset on compaction when
history_start wraps) or a general-purpose allocator with true per-line frees.
Alternative: compact + arena.reset(.retain_capacity) once live count drops
below half the high-water mark. Related: bug #371 (reflow bypasses the limit
entirely) and #359 (clock-mode churn).