VCode home

Memory headroom and parked agent processes

Agents: claude, codex, opencode · On: phone, desktop

Every agent runs inside VCode's cgroup. When the box gets close to its memory cap, new tabs are refused and idle agent processes are stopped so their tabs can be woken again on the next message.

Why you would use it

An idle claude tab holds about 480 MB with its MCP servers. Enough tabs and the machine runs into its cap, which on this box once meant a frozen desktop and a power cycle. This is what keeps that from happening while you are opening tabs from a phone.

How to use it

Nothing to do, except read the refusal when it comes.

  1. Open tabs as usual.
  2. Within 2 GiB of the cap, a new tab, an adopted session and a reopened tab are all refused.
  3. Close a tab, or wait: idle tabs park themselves under pressure.

What you see

Creating a tab near the cap fails, and the toast carries the server's words with the request in front of them, such as memory 14.2 of 16.0 GB used: close a tab first. An adopted session and a reopened tab are refused the same way.

A red toast with the memory message inside it.

A parked tab looks no different. The next message you send takes a few seconds longer while the agent starts and the session is resumed, and the server log says parked <thread> after 4 min idle.

Options and settings

Thing Value What it changes
New-tab headroom 2 GiB Below this much free, tabs cannot be created, adopted or reopened
Parking headroom 6 GiB Below this much free, idle tabs start parking
Idle before parking 2 minutes How long a tab must be quiet first
Reaper interval 60 seconds How often the check runs
CPU quiet mark 2 seconds of CPU per minute Above this, the tab is treated as working and left alone

The memory read is the cgroup's memory.current minus its reclaimable page cache (inactive_file), so a build that read a few gigabytes of files is not mistaken for a few gigabytes of live agents.

Limits and known gaps