Native memory leak: RSS reaches 1.3GB in ~7 minutes

Resolved 💬 3 comments Opened Mar 10, 2026 by jterry36 Closed Mar 14, 2026

Description

Claude Code process reaches ~1.3 GB RSS within ~7 minutes of a session. The diagnostics indicate the leak is in native memory (not the JS heap), likely in a native addon such as node-pty.

Diagnostics

Captured via /heapdump:

| Metric | Value |
|---|---|
| RSS | 1,303 MB |
| Heap Used | 208 MB |
| External | 152 MB |
| Array Buffers | 58 MB |
| Uptime | 431 seconds (~7 min) |
| Growth Rate | ~10,379 MB/hour |
| Peak Malloced | 1,303 MB |

Analysis

  • Native memory significantly exceeds V8 heap size (1.3 GB RSS vs 208 MB heap), indicating the leak is in native addons rather than JS
  • Diagnostics flagged: "Native memory > heap - leak may be in native addons (node-pty, sharp, etc.)"
  • Growth rate of ~10 GB/hour may reflect startup burst but RSS is still very high for 7 minutes of use

Environment

  • Platform: macOS (Darwin)
  • Node: v24.3.0
  • Claude Code: 2.1.71

Heap Snapshot

A .heapsnapshot file was captured and is available if needed for deeper analysis.

View original on GitHub ↗

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