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
opencode2 (@opencode-ai/cli@0.0.0-next-17088) leaks memory at a steady ~530 MB/min RSS during an active agent turn, climbing from ~3.8 GB to ~6.2 GB in ~4.5 minutes and eventually crashing the process. Related: #20695 (Memory Megathread).
Environment
opencode version: 0.0.0-next-17088 (opencode2 from @opencode-ai/cli)
OS: Linux 7.0.0-29-generic (Ubuntu, x86_64) — Linux tuxell 7.0.0-29-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 17 20:52:35 UTC 2026 x86_64 GNU/Linux
Terminal: TERM=xterm-256color, COLORTERM=truecolor (no TERM_PROGRAM)
Shell: /bin/bash
Install/channel: next — binary opencode2.exe via npm global @opencode-ai/cli@0.0.0-next-17088 (~/n/bin/opencode2 → @opencode-ai/cli/bin/opencode2.exe)
Observe linear RSS growth until the process dies / becomes unusable.
Expected Behavior
RSS should stay roughly stable or grow slowly with context, not hundreds of MB per minute during a normal agent turn. The process should not OOM/crash from unbounded growth.
Actual Behavior
Near-linear RSS growth while an agent turn is active:
Time (CEST)
RSS (KB)
RSS (MB)
Δ / 30s (MB)
09:50:33
3,910,156
3,819
—
09:51:03
4,177,524
4,080
+261
09:51:33
4,454,140
4,350
+270
09:52:03
4,722,152
4,612
+262
09:52:33
4,989,172
4,872
+261
09:53:03
5,271,300
5,148
+276
09:53:33
5,534,664
5,405
+257
09:54:03
5,828,616
5,692
+287
09:54:33
6,076,260
5,934
+242
(log end)
6,367,028
6,218
—
Derived from full /tmp/opencode_mem.log (10 samples):
Start RSS: ~3.8 GB → end: ~6.2 GB
Total growth: ~2.4 GB in ~4.5 min
Average: ~267 MB / 30s ≈ ~533 MB/min
VSZ also climbs in lockstep (~80 GB range; large virtual map)
Process eventually crashes / becomes unusable (continuous crash loop from user POV). Host has 29 GiB RAM; swap was already under pressure (free: ~4.9 GiB swap used at capture time).
Additional Context
Workload during leak: active agent turn (streaming + tools), not idle.
Session had multiple MCP servers and subagent use available; leak observed under normal interactive agent work.
Heap snapshot not yet captured — will follow megathread flow and upload:
Manual: Ctrl+P → “heap snapshot” while RSS is elevated, upload to the Dropbox request in Memory Megathread #20695
Auto: OPENCODE_AUTO_HEAP_SNAPSHOT=1 opencode2 then use until RSS > ~2 GB; snapshots land in the log dir as .heapsnapshot
Summary
opencode2(@opencode-ai/cli@0.0.0-next-17088) leaks memory at a steady ~530 MB/min RSS during an active agent turn, climbing from ~3.8 GB to ~6.2 GB in ~4.5 minutes and eventually crashing the process. Related: #20695 (Memory Megathread).Environment
0.0.0-next-17088(opencode2from@opencode-ai/cli)Linux tuxell 7.0.0-29-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 17 20:52:35 UTC 2026 x86_64 GNU/LinuxTERM=xterm-256color,COLORTERM=truecolor(noTERM_PROGRAM)/bin/bashopencode2.exevia npm global@opencode-ai/cli@0.0.0-next-17088(~/n/bin/opencode2→@opencode-ai/cli/bin/opencode2.exe)@sveltejs/opencode(configured)~/.config/opencode/plugins/notify.ts,worktree.ts@knikolov/opencode-plugin-simple-memory(verify if still loaded)auto: false,prune: falseReproduction
opencode2in a project session (managed/background service default).Expected Behavior
RSS should stay roughly stable or grow slowly with context, not hundreds of MB per minute during a normal agent turn. The process should not OOM/crash from unbounded growth.
Actual Behavior
Near-linear RSS growth while an agent turn is active:
Derived from full
/tmp/opencode_mem.log(10 samples):Process eventually crashes / becomes unusable (continuous crash loop from user POV). Host has 29 GiB RAM; swap was already under pressure (
free: ~4.9 GiB swap used at capture time).Additional Context
OPENCODE_AUTO_HEAP_SNAPSHOT=1 opencode2then use until RSS > ~2 GB; snapshots land in the log dir as.heapsnapshot