Uh oh!
There was an error while loading. Please reload this page.
fix: address 6 memory leaks for long-running sessions - #13594
Conversation
The following comment was made by an LLM, it may be inaccurate: Potential duplicate PRs found:
Please review PRs #10914 and #12053 to confirm if they overlap with the current PR #13594, particularly regarding the changes to |
bcf473e to
00142d4CompareTheAllSeeingPie
commented
Feb 16, 2026
This would supersede #10914 and #12053 and bring significant stability to the Opencode platform and make it way more viable for power-users like myself who want to run multiple sessions for many hours. |
- queue.ts: add close()/drain() methods and termination to AsyncQueue iterator - bash.ts: replace string concatenation with Buffer[] ring buffer (10MB cap) - client.ts: clear diagnostics on shutdown, add 5000-entry LRU eviction - bus/index.ts: clear subscriptions map in dispose callback - pty/index.ts: replace string buffer with chunked array to reduce GC pressure - index.ts: call Instance.disposeAll() in finally block for resource cleanup Closesanomalyco#10913
00142d4 to
9d77518CompareClosing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Summary
Fixes 6 memory leaks that cause RSS to grow to multi-GB levels during long-running sessions.
Changes
queue.ts— AsyncQueue terminationclose()anddrain()methods withDONEsentinel symbol[Symbol.asyncIterator]now breaks on close instead of looping foreverbash.ts— Output buffer capoutput += chunk.toString()withBuffer[]ring bufferlsp/client.ts— Diagnostics Map cleanupdiagnostics.clear()onshutdown()bus/index.ts— Subscription cleanup on disposesubscriptions.clear()in dispose callback after notifying wildcard listenerspty/index.ts— Buffer chunkingbuffer: stringwithbufferChunks: string[]+bufferLentrackerstring.slice()on every writeindex.ts— Shutdown resource cleanupInstance.disposeAll()infinallyblockTest plan
bunx tsc --noEmit— zero type errorsturbo typecheckacross all 12 packages — all passCloses#10913