VS Code extension: Renderer OOM crash (code -536870904) and MaxListenersExceeded memory leak in extension host

Resolved 💬 3 comments Opened Mar 18, 2026 by mdileocytra Closed Mar 22, 2026

Bug Description

The Claude Code VS Code extension causes two related memory issues that lead to VS Code crashes:

  1. Chromium renderer process OOM (exit code -536870904 / 0xE0000008) after 4-12 hours of use
  2. MaxListenersExceeded warning appearing within 19 minutes of session start, indicating an EventEmitter memory leak in the extension host process

These are distinct failure modes — the renderer OOM kills the entire VS Code window, while the MaxListenersExceeded leak degrades the extension host over time.

Environment

  • OS: Windows 11 Enterprise 10.0.26200 (Azure AD cloud PC)
  • RAM: 32 GB
  • VS Code: 1.111.x (Insider is not used)
  • Claude Code extension: 2.1.77 (win32-x64)
  • Node.js: v22.22.0

Steps to Reproduce

  1. Open VS Code with Claude Code extension
  2. Open 2-3 Claude Code conversation tabs (panel mode, not terminal)
  3. Use actively for 4-12 hours (tool calls, code generation, MCP server interactions)
  4. VS Code window terminates with: "The window terminated unexpectedly (reason: 'oom', code: '-536870904')"

Evidence

MaxListenersExceeded Memory Leak

The warning MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process] appears consistently within 19-33 minutes of session start:

  • Window1 (no affinity): appeared at 33 minutes on shared extension host (pid 22128)
  • Window2 (with affinity): appeared at 19 minutes on Claude Code's isolated extension host (pid 62016)

Since it appears even with extensions.experimental.affinity isolating Claude Code into its own extension host, the leak is within Claude Code's own process. Something is adding exit event listeners without removing them.

Claude Helper Process Memory Growth

From process snapshots during active use, individual claude helper processes grow to 566-638 MB RSS each. Over a 9-hour session, one process reached:

RSS: 0.93 GB
Committed: 2.77 GB
Page faults: 17,673,852

Before crashing with "Illegal instruction" (Bun runtime crash).

Renderer OOM Timeline (March 17 crash)

Mar 16 23:23 — Window opened
Mar 16 23:56 — MaxListenersExceeded warning (33 min in)
Mar 17 08:57 — Claude Code CLI process crashes (0.93GB RSS, 17.6M page faults)
Mar 17 11:01 — Renderer OOM: "CodeWindow: renderer process gone (reason: oom, code: -536870904)"

Session duration at crash: ~11.5 hours.

March 18 crash

Another renderer OOM after ~6 hours, even with mitigations applied. Process snapshot at time of investigation:

  • 4 claude processes at 566-638 MB each = ~2.4 GB
  • 2 claude processes at 215-245 MB = ~0.5 GB
  • 20+ node processes at 96-199 MB each = ~2.7 GB
  • Total VS Code ecosystem: ~8 GB of 32 GB system RAM

Mitigations Already Applied (Crashes Still Occur)

| Mitigation | Applied | Helps? |
|-----------|---------|--------|
| extensions.experimental.affinity (Claude Code in group 1) | Yes | Isolates blast radius, but MaxListenersExceeded still appears in isolated host |
| argv.json with --max-old-space-size=8192 | Yes | Helps extension hosts, does NOT help renderer (V8 pointer compression 4GB cap) |
| Removed chat.useClaudeHooks | Yes | Reduced Copilot Chat conflict |
| Uninstalled GitHub Copilot Chat | Yes | Reduced memory pressure |
| Reduced MCP servers from 7+ to 3-4 | Yes | Reduced node process count |
| Archived old conversation .jsonl history | Planned | Not yet tested |

Root Cause Analysis

The renderer OOM is caused by V8 pointer compression in Electron imposing a hard ~4GB cap per renderer process. Each Claude Code conversation tab is a webview that accumulates DOM nodes (tool outputs, code blocks, large responses) in the renderer's memory. Combined with the MaxListenersExceeded leak in the extension host, overall system memory pressure eventually forces the renderer into OOM.

The MaxListenersExceeded leak suggests that event listeners (specifically exit listeners on the process object) are being registered repeatedly — possibly during MCP server connections, tool call lifecycle events, or conversation panel creation — without being properly cleaned up.

Expected Behavior

  • Claude Code should not leak EventEmitter listeners in its extension host
  • Claude helper processes should not grow unboundedly (soft cap or periodic GC)
  • Long-running sessions (4-12 hours) should remain stable without requiring VS Code restarts
  • Webview content should be virtualized or have DOM size limits to prevent renderer heap exhaustion

Current Workaround

Restart VS Code every 4-6 hours and limit to 2-3 Claude Code tabs per window. Multiple VS Code windows help because each gets its own renderer process with its own 4GB budget.

Related Issues

  • #8722 — Conversation history accumulates to 700MB+ with no cleanup
  • #10520 — Extension host OOM during initialization
  • #21182 — 11.6GB per conversation window memory leak
  • #22225 — 6GB + 2GB memory usage after launch
  • #15906 — Worker processes leak when creating new chats
  • #33963 — 2.6GB+ usage with no memory self-monitoring

/label bug,memory,vscode-extension

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗