Memory leak: ArrayBuffers grow ~980 MB/hour in long sessions

Resolved 💬 3 comments Opened Mar 11, 2026 by VolkovIlia Closed Mar 15, 2026

Description

Claude Code accumulates ~6 GB of memory (mostly ArrayBuffers) during a 6-hour session, growing at ~980 MB/hour. The JS heap itself stays small (~77 MB), indicating the leak is in external/native buffers rather than JS objects.

Diagnostics

From /heapdump diagnostics output (v2.1.72, Node v24.3.0, Linux):

{
  "uptimeSeconds": 22123,
  "memoryUsage": {
    "heapUsed": 6618384085,
    "heapTotal": 76737536,
    "external": 6572254960,
    "arrayBuffers": 6000788535,
    "rss": 6313570304
  },
  "memoryGrowthRate": {
    "bytesPerSecond": 285384,
    "mbPerHour": 979.79
  }
}

Key observations:

  • ArrayBuffers: 6.0 GB — 95% of total memory
  • JS Heap: 77 MB — normal, no JS-side leak
  • External: 6.6 GB — native/C++ allocations not being freed
  • Growth rate: ~980 MB/hour — linear, not bounded

Session characteristics

  • Duration: ~6 hours
  • Activity: heavy use of Agent tool (subagents), multiple git operations, SSH via Bash, file reads/edits
  • MCP servers active: context7, sequential-thinking, memory, playwright
  • Platform: Linux (Fedora 43), Node v24.3.0

Suspected cause

ArrayBuffers accumulating without GC — likely from:

  • Conversation transcript compression buffers not being released
  • MCP server communication buffers (stdin/stdout pipes)
  • Subagent spawn/result buffers retained after completion

Workaround

Restarting the session (/exitclaude) reclaims all memory. But sessions over ~3-4 hours become problematic (swap pressure, system slowdown).

Environment

  • Claude Code version: 2.1.72
  • Node.js: v24.3.0
  • OS: Linux 6.18.13-200.fc43.x86_64 (Fedora 43)
  • RAM: 16 GB

View original on GitHub ↗

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