claude-code - 💡(How to fix) Fix [BUG] Severe native memory leak (~738 GB/h) — CLI fully unresponsive (slash commands frozen) on macOS

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Error Messages/Logs

Root Cause

Heapdump file (~31 MB) is NOT in the public bundle because raw heap snapshots can contain in-memory tokens. Happy to share privately with maintainers — please advise the right channel ([email protected] referencing this issue?).

Code Example

/heapdump output during freeze:

RSS                     0.32 GB (peak 0.32 GB)
JS heap                 0.04 GB   in snapshot
array buffers           0.01 GB   not in snapshot
other external          0.03 GB   not in snapshot
unaccounted             0.24 GB   not in snapshot (code/JIT/stacks/allocator)

Native memory > heap — leak may be in native addons (node-pty, sharp, etc.)
High memory growth rate: 765,120.0 MB/hour
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

I have been using Claude Code daily for about a month without issues. Starting yesterday, it freezes mid-task in a very specific pattern:

  • I send a prompt. Claude shows the "thinking" timer and starts consuming tokens.
  • The elapsed-time counter advances, but NO actual work happens — no tool calls, no edits, no output.
  • I stop / pause and re-send the same prompt. Same result: tokens consumed, timer runs, nothing executed.
  • This repeats 3–4 times; on the 4th–5th attempt it sometimes starts working.

When I run /heapdump during a freeze, it reports: RSS 0.32 GB (peak 0.32 GB), JS heap 0.04 GB, ~0.24 GB unaccounted native memory. ⚠ Native memory > heap — leak may be in native addons (node-pty, sharp, etc.) ⚠ High memory growth rate: 765,120 MB/hour

So the native (off-heap) portion is ~6× the JS heap and growing at ~765 GB/h according to Claude's own diagnostic. Slash commands like /bug, /doctor, /clear are also frozen during the incident.

I'm on the Max plan; this is making the product unusable.

What Should Happen?

A prompt should start producing tool calls / output normally, without a freeze where tokens are spent but no work happens. Memory should not grow at hundreds of GB per hour.

Error Messages/Logs

/heapdump output during freeze:

RSS                     0.32 GB (peak 0.32 GB)
JS heap                 0.04 GB   in snapshot
array buffers           0.01 GB   not in snapshot
other external          0.03 GB   not in snapshot
unaccounted             0.24 GB   not in snapshot (code/JIT/stacks/allocator)

⚠ Native memory > heap — leak may be in native addons (node-pty, sharp, etc.)
⚠ High memory growth rate: 765,120.0 MB/hour

Steps to Reproduce

  1. Open my working project (folder on macOS Desktop) in Claude Code. The project has multiple MCP servers configured (Claude Preview, Claude in Chrome, Postgres, Sentry, GitHub, Context7, scheduled-tasks, pdf-viewer, mcp-registry, etc.).
  2. Send any prompt — e.g. ask to edit a file.
  3. The "Claude is thinking" timer starts; tokens are consumed; no tool calls or output are produced.
  4. Pause and re-send the same prompt — same behavior.
  5. After 3–4 retries it MAY start working; often it does not.

Things I have already tried (none fixed it):

  • Archived all sessions, fully uninstalled and reinstalled Claude Code, re-imported sessions.
  • Reconnected Wi-Fi (suspected packet loss — no change).
  • Cleared cache.
  • Disconnected MCP servers.

I have NOT yet tested in a completely empty/clean project directory. Will update the issue after testing.

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

Claude.app 1.6608.2 (desktop app; CLI not installed)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Plan: Max.

Attached diagnostic bundle: cc-bug-report.tar.gz (95 KB)

  • user-report.md : original first-person account of the incident and the full /heapdump output
  • logs/Library-Logs-Claude : main.log, mcp.log, etc.
  • logs/dot-claude-telemetry: 1p_failed_events.* (may indicate connectivity / event-delivery issues)
  • config/*.redacted : MCP and settings configs (secrets masked)
  • system/* : versions, OS, processes, artifact sizes

Heapdump file (~31 MB) is NOT in the public bundle because raw heap snapshots can contain in-memory tokens. Happy to share privately with maintainers — please advise the right channel ([email protected] referencing this issue?).

Possible angles, just from the /heapdump warning:

  • native-addon leak (node-pty / sharp / similar)
  • very large MCP-server fan-out in this project

Will follow up after testing in an empty directory to isolate project-specific triggers.

222.tar.gz

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING