Skip to content

Memory leak on Linux - RAM grows to 20GB+ causing system crash #20777

Description

@Noammandelbaum

Description

Claude Code consumes excessive memory on Linux, growing to 20GB+ RAM usage during simple conversations, causing system crashes.

Environment

  • Claude Code version: 2.1.15
  • Node.js version: v24.13.0
  • OS: Ubuntu Linux (kernel 6.14.0-37-generic)
  • System RAM: 32GB

Steps to Reproduce

  1. Start Claude Code on Ubuntu Linux
  2. Have a simple conversation (just text, no large files or complex operations)
  3. Monitor memory usage with ps aux | grep claude
  4. RAM usage grows continuously to 20GB+ within minutes

Expected Behavior

Memory usage should remain reasonable (under 1-2GB) for simple text conversations.

Actual Behavior

  • Memory usage grows to 20GB+ (61%+ of 32GB RAM)
  • System becomes unresponsive and crashes
  • This has caused 5+ system crashes

Additional Context

  • This issue does NOT occur on Windows - the same user previously used Claude Code on Windows with only 4GB RAM without any issues
  • Cache/history files are normal size (~83MB total in ~/.claude)
  • The issue appears to be Linux-specific
  • Workaround: Setting NODE_OPTIONS="--max-old-space-size=5120" to limit memory

Workaround

Adding to ~/.bashrc:

export NODE_OPTIONS="--max-old-space-size=5120"

This prevents system crashes but Claude Code may crash when hitting the limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions