Claude Code crashes with OOM (2.6GB+) — no memory self-monitoring or graceful degradation

Resolved 💬 4 comments Opened Mar 13, 2026 by crossman73 Closed Apr 11, 2026

Summary

Claude Code process (claude.exe) consumed 2.6GB + 660MB of memory during a session, triggering a Windows Resource Exhaustion event and causing the process to be OOM-killed by the OS. The terminal survived but Claude Code silently crashed mid-operation — no state was saved, no warning was given, and no recovery was possible.

Environment

  • OS: Windows 11 Home 10.0.26220
  • RAM: 24GB total
  • Claude Code: Native install (~/.local/bin/claude.exe)
  • Concurrent load: WSL (~1.4GB), Comet browser

Steps to Reproduce

  1. Start a Claude Code session with multiple tool calls and research
  2. Trigger long cogitation (1m+ thinking) while a background task is running
  3. Memory climbs to ~3.3GB total (main process 2.6GB + child 660MB)
  4. Windows detects low virtual memory → force-kills claude.exe
  5. Session drops to terminal with no handoff, no checkpoint, no error message

Windows Event Log Evidence

Source: Microsoft-Windows-Resource-Exhaustion-Detector
Message: Windows successfully diagnosed a low virtual memory condition.
  claude.exe (31460) consumed 2,815,025,152 bytes
  vmmemWSL (27468) consumed 1,527,316,480 bytes
  claude.exe (31848) consumed 693,280,768 bytes

Expected Behavior

Claude Code should:

  1. Self-monitor memory usage — track its own RSS/virtual memory periodically
  2. Degrade gracefully — when approaching a threshold (e.g., 2GB):
  • Stop spawning background tasks
  • Compress/release context proactively
  • Warn the user
  1. Checkpoint periodically — save session state so that on crash, recovery is possible
  2. Never silently die — at minimum, write a crash log or state file before exiting

Actual Behavior

  • No memory monitoring
  • No warning before crash
  • No state saved
  • No crash log
  • Session work lost — user has to manually reconstruct what happened

Impact

On systems with moderate RAM (16–24GB), Claude Code can easily hit OOM during complex sessions with concurrent operations. This is especially problematic because:

  • Users on these systems tend to run other applications alongside Claude Code
  • Long cogitation + background tasks can spike memory unpredictably
  • Silent crash with no recovery = lost work and user frustration

Suggested Fix

  • Internal memory budget (configurable, default ~2GB)
  • Periodic RSS check → graduated response (warn → degrade → save-and-exit)
  • Crash recovery file (~/.claude/last_session_state.json) written on periodic checkpoints

View original on GitHub ↗

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