Skip to content

Bug: Intermittent 12 GB RSS spike during subagent spawning (heavy plugin/skill/MCP usage) #29910

@muntasirrmahdi

Description

@muntasirrmahdi

Description

Hey, I have been seeing opencode spike to 10-12 GB RAM usage on my system (15 GB total). It happens out of nowhere - RAM shoots up to 72% usage, then a few minutes later it drops back down to ~700 MB on its own. No crash, no OOM. Just massive temporary spikes that freeze the system.

This started about a month ago. Never happened before even with heavy agent usage.

Plugins

oh-my-openagent v4.5.1 (with @opencode-ai/plugin v1.15.12)

OpenCode version

v1.15.12

Steps to reproduce

It is not perfectly reproducible but the pattern is: start a session with accumulated context (old opencode.db), let oh-my-openagent spawn subagents via task(). Watch RSS climb. It happens most reliably with longer sessions where the DB has a lot of history.

Screenshot and/or share link

Operating System

Ubuntu 24.04

Terminal

GNOME Terminal


I grabbed /proc/PID/status when it was spiking:

VmHWM:    12,144,816 kB
VmData:   55,254,068 kB
VmPeak:  135,414,188 kB
VmSize:   77,820,920 kB
VmRSS:       784,484 kB   (this was after the spike already dropped)

VmHWM of 12 GB means it really did hit that much physical RAM at peak. VmData 55 GB is the heap arena - that is huge.

My guess about what is happening: the 55 GB VmData is the V8 heap arena holding all the metadata from 154 skills + 12 MCP server schemas + oh-my-openagent. When a subagent spawns, all those pages become hot at once, causing the RSS spike. After the subagent finishes the pages go cold again and the kernel reclaims them.

I have been using cgroups v2 MemoryHigh=6G as a workaround and it works - keeps RSS from blowing past 6 GB without killing anything. But the underlying arena is still 55 GB.

I also have opencode.db at 835 MB which I think makes it worse (the 4x message copy thing from #29730).

I saw similar reports: #29671 (same symptoms from yesterday), #29730 (OOM kill from the message copy pattern), and #20695 (memory megathread).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions