anomalyco / anomalyco/opencode
service: idle background daemon holds ~700-800MB RSS
@kitlangton is already working on this.
Since Aug 13, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Summary
The serve --service background daemon stays resident 24/7 holding ~700-800 MB RSS with no active sessions and 0% CPU (97% of sample frames in kevent64 wait), which shows up as a permanent memory/energy footprint in Activity Monitor on a 16 GB MacBook Air.
Environment
- opencode version: 0.0.0-next-17403 (next channel, V2 beta)
- OS: macOS 26.6.1 (Darwin 25.6.0, arm64)
- Terminal: Apple_Terminal, TERM=xterm-256color
- Shell: /bin/zsh
- Install/channel: local binary in ~/.opencode/bin, channel
next - Active plugins: ~/.config/opencode/plugins.v2/memory.ts (opencode-memory)
Reproduction
- Run
opencode2in a terminal (attaches to theserve --servicedaemon). - Close the TUI session; the daemon remains in the background.
- Measure:
ps -o pid,rss,pcpu,command -p <daemon-pid>andsample <daemon-pid>.
Observed:
- Daemon RSS: ~700-780 MB while idle, 0% CPU
sample: main thread 1676/1729 frames inkevent64(waiting), all worker threads in_pthread_cond_wait— fully idle but not releasing memory- With an active TUI session (~600 MB) plus MCP children (~350 MB), total opencode2 footprint reached ~2 GB
Expected Behavior
An idle background daemon should hold a much smaller resident footprint (tens of MB), or exit when no sessions are active, or make residency configurable.
Actual Behavior
~700-800 MB RSS stays permanently resident even with no sessions open; macOS Activity Monitor reports it as a persistent energy/memory consumer and the memory is never reclaimed.
Additional Context
Workarounds: opencode2 service stop when not needed, or --standalone mode (private per-session server) to avoid a persistent daemon. Also observed: a leftover TUI session process remained in stopped state (T/SIGSTOP, ~240 MB RSS) after sessions were closed — likely job-control related, but it was not reaped either. Reproduction is consistent: the daemon holds this footprint every day.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.