Memory leak: native ArrayBuffer/Blob accumulation causing ~42 GB/hour growth (v2.1.71)

Resolved 💬 3 comments Opened Mar 21, 2026 by pagcoinbr Closed Mar 25, 2026

Bug Description

Claude Code v2.1.71 exhibits a severe memory leak, with RSS growing at approximately 42 GB/hour. A heap dump taken after just 31 seconds of uptime already showed 363 MB RSS.

Environment

  • Claude Code version: 2.1.71
  • Node.js version: v24.3.0
  • Platform: Linux 6.8.0-101-generic
  • Trigger: Manual /heapdump after noticing high memory usage

Diagnostics Summary

RSS:           380 MB (after 31s uptime)
Heap used:     114 MB
External:       75 MB
ArrayBuffers:   25 MB
Growth rate:    ~42,430 MB/hour (~12.4 MB/s)
Peak malloc:   1.18 GB

Heap Analysis

| Size | Object | Count |
|------|--------|-------|
| 16 MB | ArrayBuffer | 8 |
| 10 MB | Blob (native) | 8 |
| 9 MB | FunctionCodeBlock | 2,416 |
| 6 MB | UnlinkedFunctionCodeBlock | 9,896 |
| 3.7 MB | Function closures | 122,051 |

Key Findings

  1. Native memory exceeds heap: 75 MB external vs 48 MB heap total — the diagnostics tool flagged this as a potential leak in native addons (node-pty, sharp, etc.)
  2. 8 large ArrayBuffers (16 MB) + 8 Blobs (10 MB) accumulating rapidly — likely API response bodies or terminal I/O buffers not being released
  3. 122,051 closures in just 31 seconds of runtime seems high
  4. The full CHANGELOG text (0.26 MB) is retained as a string in memory

Steps to Reproduce

  1. Start Claude Code v2.1.71 on Linux
  2. Monitor RSS with ps or /heapdump
  3. Memory grows continuously without user interaction

Attached Diagnostics

The diagnostics JSON potentialLeaks array flagged:

  • "Native memory > heap - leak may be in native addons (node-pty, sharp, etc.)"
  • "High memory growth rate: 42429.8 MB/hour"

🤖 Generated with Claude Code

View original on GitHub ↗

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