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
Memory leak: Multiple opencode processes accumulate over days and don't terminate on session exit #14199
When using opencode interactively, multiple opencode processes accumulate over time and don't terminate properly when sessions end. This leads to multiple processes running simultaneously (5+ observed), each consuming 300-1000MB, with processes dating back 3-5 days. Total memory consumption reached 3.35GB across 5 processes, contributing to system freeze on Ubuntu server (94.44% RAM used, OOM crash).
Steps to reproduce:
Start opencode session
Use it for some time
Exit session normally
Start new session in different project
Repeat over several days
Check: ps aux | grep opencode
Actual: Multiple opencode processes remain after sessions end (PID examples from 3-5 days old)
Expected: Process should terminate on session exit, releasing memory and file descriptors.
Environment: opencode 1.2.x on macOS and Linux (arm64/x86_64)
Root cause: Background processes not killed on session exit, event listeners not cleaned up, improper signal handling.
Proposed fixes: Proper session tracking and child process termination on exit, auto-cleanup of stale processes (>24h), improved process lifecycle in opencode serve, --cleanup flag.
Reacted by Omer Faruk Oruc, James Veitch, Kryštof Řezáč, Matt Shapiro and Cesar Hinojosa
Activity
thdxr commentedon Apr 2, 2026
Closing in favor of #20695 where we're collecting all memory-related problems. Please follow that issue for updates.