Native memory leak (node-pty) on Node v24 + macOS Darwin
Resolved 💬 8 comments Opened Mar 10, 2026 by pproenca Closed Apr 9, 2026
Description
Claude Code v2.1.72 exhibits a native memory leak on macOS (Darwin 25.3.0) with Node.js v24.3.0. The leak is in native addons (likely node-pty), not in the V8 JavaScript heap.
Diagnostics
- CC Version: 2.1.72
- Node Version: v24.3.0
- Platform: darwin (Darwin 25.3.0)
- Trigger: manual heap dump after ~57 seconds of uptime
Memory Usage
| Metric | Value |
|--------|-------|
| heapUsed | 118 MB |
| heapTotal | 49 MB |
| external | 77 MB |
| arrayBuffers | 21 MB |
| RSS | 327 MB |
Growth Rate
- ~5.7 MB/s (~19.8 GB/hour)
Analysis
- Native memory (118 MB) exceeds V8 heap (49 MB), indicating the leak is in native addons (
node-pty,sharp, etc.), not in JavaScript heapUsed > heapTotalconfirms memory is being allocated outside the managed V8 heapmaxRSSreported as 659 GB (likely a measurement/unit anomaly)
Steps to Reproduce
- Run Claude Code v2.1.72 on macOS with Node.js v24.3.0
- Take a heap dump after ~1 minute (
/heapdump) - Observe native memory significantly exceeding V8 heap and high growth rate
Expected Behavior
Memory usage should stabilize after initial startup, not grow at ~5.7 MB/s indefinitely.
Heap Snapshot
A .heapsnapshot file is available and can be shared if needed for further analysis in Chrome DevTools.
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗