Files
orca/config
Brennan Benson c4db330225 fix(terminal): release parent chunks pinned by drained output slices
takeQueuedChunk stored the unconsumed remainder back into the queue as
chunk.data.slice(remaining). V8 backs that with a SlicedString pointing at
the whole parent, so a nearly drained 2 MB chunk kept all 2 MB alive to serve
a few KB tail while queuedChars was charged only for the remainder. Fully
consumed chunks were also left referenced until the 64-chunk compaction, so
they retained their strings and callbacks while charging nothing at all.

Track what each chunk really pins in retainedChars and copy the residual flat
once it pins twice its own length. Halving bounds retention to ~2x the honest
queued chars and keeps total copying linear in the original chunk, and the
drain path measured no slower. Drained slots are replaced with an empty
placeholder, which nothing below chunkIndex ever reads.

Measured with 8 background terminals drained to a <=64 KB tail:
8,710,264 bytes retained before, 342,776 after.
2026-08-07 06:15:14 -07:00
..
2026-08-05 12:09:24 -07:00
2026-08-05 12:09:24 -07:00
2026-08-05 12:09:24 -07:00