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
fix: multiple memory leaks in long-running sessions #10913
Several memory leaks occur during long-running opencode sessions, causing RSS to grow continuously:
AsyncQueue never terminates (util/queue.ts) - [Symbol.asyncIterator] loops forever with no close mechanism, preventing GC of consumers.
Bash tool unbounded string concatenation (tool/bash.ts:167-189) - stdout/stderr appended via output += chunk.toString() with no size limit. Commands producing large output (e.g., find /) cause unbounded memory growth.
LSP diagnostics Map never cleared (lsp/client.ts:51) - diagnostics Map accumulates entries indefinitely. shutdown() disposes the connection but doesn't clear the map.
Bus subscriptions Map not cleared on dispose (bus/index.ts) - Instance dispose callback fires wildcard subscribers but never calls subscriptions.clear().
PTY buffer string concatenation (pty/index.ts:136-150) - session.buffer += data then session.buffer.slice(-BUFFER_LIMIT) causes repeated large string allocation and GC pressure.
Instance.disposeAll() not called on process exit (index.ts) - The main finally block calls process.exit() without disposing instances, leaking subprocess handles.
Reproduction
Start opencode, run a command producing large output (find / -name "*.ts")
Monitor with top -pid <PID> - RSS grows without bound
Looks like people haven't gotten a fix working for all the memory issues. Anyone see improvement with this? My opencode serve is killing my server multiple times per day requiring hard reboot.
Activity
github-actions commentedon Jan 27, 2026
This issue might be a duplicate of existing issues. Please check:
Feel free to ignore if none of these address your specific case.
KaranjotVendal commentedon Feb 3, 2026
I believe I have encountered the same issue. Seems like the following PR #11717 and PR #10914 seems to be fixing the solution.
cdenneen commentedon Feb 18, 2026
Looks like people haven't gotten a fix working for all the memory issues. Anyone see improvement with this? My opencode serve is killing my server multiple times per day requiring hard reboot.
fix: address 6 memory leaks for long-running sessions
thdxr commentedon Apr 2, 2026
Closing in favor of #20695 where we're collecting all memory-related problems. Please follow that issue for updates.