Memory usage grows to 10GB+ in long sessions with Opus 4.7 (1M context)
Version: 2.1.118
OS: macOS Darwin 25.3.0
Model: Opus 4.7 with 1M context (claude-opus-4-7[1m])
What happened
After an active session of roughly 1–2 hours (mix of file reads, several large Write tool outputs, ongoing conversational tool use), the Claude Code Node process showed >10 GB RSS in Activity Monitor. The machine has plenty of RAM but the climb was monotonic — never observed the process release memory back to the OS while still running.
Reproduction
Hard to give an exact minimal repro, but the pattern that triggered it on my machine:
- Session on Opus 4.7 1M context
- Multi-tool work over an extended period (multiple
Readcalls,Writeproducing ~30 KB HTML/markdown files, repeatedBashcalls) - Long conversational context with many prior tool results still in the transcript
Only fully quitting Claude Code reliably releases the memory.
It would be useful to know whether /compact and /clear are expected to reclaim heap within the same process. If they don't release significant memory, that suggests tool-result data is being retained on the JS heap beyond what's needed for the active conversation window.
Side note — process display name
Activity Monitor shows the process as "2.1.118" (the version number) instead of "Claude Code". Likely because the macOS bundle metadata (CFBundleName / CFBundleDisplayName) isn't set. Minor UX issue, but it makes the process very hard to identify when troubleshooting memory/CPU problems — I initially thought it was malware.
Install path
~/.local/share/claude/versions/2.1.118
Asks
- Investigate heap retention in long sessions with the 1M context model.
- Document the expected behavior of
/compactand/clearw.r.t. process memory. - Set a proper bundle display name so the process shows up as "Claude Code" in Activity Monitor.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗