High native memory usage (~1.77 GB RSS) on fresh session

Resolved 💬 4 comments Opened Mar 12, 2026 by bflemi3 Closed Apr 10, 2026

Description

Fresh Claude Code session reaches ~1.77 GB RSS within 22 seconds of startup. The JS heap is only ~101 MB — most memory is outside the heap, suggesting a native addon leak (likely node-pty).

Diagnostics

{
  "timestamp": "2026-03-12T12:19:18.884Z",
  "trigger": "manual",
  "uptimeSeconds": 21.63,
  "memoryUsage": {
    "heapUsed": 106379784,
    "heapTotal": 44768256,
    "external": 68670880,
    "arrayBuffers": 19536120,
    "rss": 1771929600
  },
  "memoryGrowthRate": {
    "bytesPerSecond": 81912962,
    "mbPerHour": 281225
  },
  "v8HeapStats": {
    "mallocedMemory": 106642176,
    "peakMallocedMemory": 1771962368
  },
  "analysis": {
    "potentialLeaks": [
      "Native memory > heap - leak may be in native addons (node-pty, sharp, etc.)",
      "High memory growth rate: 281225.8 MB/hour"
    ]
  }
}

Environment

  • Claude Code version: 2.1.73
  • Node.js: v24.3.0
  • Platform: macOS (Darwin 24.6.0)
  • Machine: 16 GB RAM

Analysis

  • RSS: 1.77 GB vs heap used: ~101 MB — ~94% of memory is outside the JS heap
  • peakMallocedMemory (1.77 GB) closely matches RSS, pointing to native allocations
  • Diagnostics flagged native addon memory as a potential leak source

Heapsnapshot

A .heapsnapshot file was captured and is available on request if helpful for further analysis.

View original on GitHub ↗

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