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
Server mode: InstanceStore never evicts per-directory instances (unbounded memory) #33720
opencode serve keeps one InstanceStore entry per directory (resolved from the x-opencode-directory header) and never frees it — there is no idle TTL, LRU, or max-size eviction in packages/opencode/src/project/instance-store.ts. A long-running server that receives requests for many distinct directories (e.g. a client that uses one directory per session) accumulates one instance per directory for the lifetime of the process. Each instance holds its own file watchers, LSP/MCP subprocesses, plugins and bus subscriptions, so RSS grows without bound until the process is OOM-killed.
Instances are only freed by an explicit POST /instance/dispose, reload, or disposeAll, so a client that never disposes (or crashes first) leaks every directory it has touched.
OpenCode version
1.17.9 (serve)
Steps to reproduce
Start opencode serve.
Repeatedly create a session and send a prompt, each with a different x-opencode-directory value (one directory per session).
RSS of the server climbs linearly with the number of distinct directories and never drops; eventually OOM.
Activity
github-actions commentedon Aug 24, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.