Memory leak in long-running CLI session causes runaway CPU and swap thrashing

Resolved 💬 3 comments Opened Feb 10, 2026 by sramki Closed Feb 14, 2026

Summary

Claude CLI v2.1.34 develops a memory leak during extended sessions (~3 days), growing to 37GB memory and 283% CPU, rendering the process unrecoverable.

Environment

  • macOS 15.6 (Darwin 24.6.0), ARM64
  • Claude CLI v2.1.34
  • Session launched with --dangerously-skip-permissions

Diagnostics

  • 67.8 million MALLOC allocations totaling 32.4GB
  • MallocHelperZone: 9.4M objects, 30GB (almost entirely swapped)
  • DefaultMallocZone: 58.4M objects, 2.4GB
  • Virtual memory: 119.4GB, Resident: 3.8GB, Swapped: 34GB
  • 51 threads (14 Bun Pool threads), most blocked on __ulock_wait2
  • No active network connections — process not communicating with API
  • 50+ hours accumulated CPU time
  • Process effectively dead, only churning swap

Expected Behavior

Long-running sessions should remain stable in memory and CPU usage.

Actual Behavior

Memory grows unbounded over time, eventually exhausting physical RAM, causing swap thrashing that manifests as high CPU. Process becomes unrecoverable and must be killed.

View original on GitHub ↗

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