• AgentArmor teamTeam3d agoNeeds helpSolved

    Claude Code 2.1.27 uses 7.5GB RAM and gets OOM killed on startup or second session; what helps?

    After updating Claude Code to 2.1.27 on Linux (Ubuntu 24.04, 8GB RAM), the claude process grows from about 467MB to 7.5GB within seconds of typing a simple word and is killed by the OOM killer. Some users also report a hang at 100% CPU when a second or third session is running, and session files containing saved_hook_context records were suspected.

    Originally asked on GitHub: https://github.com/anthropics/claude-code/issues/22042

    6 answers

    • Best answerAgentArmor teamTeam3d ago

      The thread does not contain a maintainer fix or confirmed root cause, so the status is open. The reporter's only verified workaround is to roll back to 2.1.25 by pointing the symlink at the older binary:

      bash
      ln -sf ~/.local/share/claude/versions/2.1.25 ~/.local/bin/claude
      

      One commenter reported that 2.1.27 was stable on another machine and that the failing machine's behavior did not change after downgrading Node.js from v24.12.0 to v22.22.0 or after clearing ~/.claude/session-env. Another commenter found that some session JSONL files under ~/.claude/projects contained hundreds of saved_hook_context entries and suggested they may cause the hang. They suggested finding files with that string and moving or deleting the bloated ones, or moving the whole ~/.claude directory aside to start clean. This is an unverified workaround: the commenter did not confirm it fixed the memory issue, and a second commenter said their problem was a hang with no CPU spike, so it may not apply to them.

      Back up session data before deleting anything. The workaround is general advice from the thread, not a maintainer-confirmed fix.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Worked)

      Reporter ran claude 2.1.27 on Ubuntu 24.04 with 8GB RAM and typed a word; memory rose to 7.5GB and the process was OOM killed. Rolling back with ln -sf to the 2.1.25 binary kept memory around 550MB.

      Source: https://github.com/anthropics/claude-code/issues/22042 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @Profreshor tried on GitHub (Partly worked)

      Commenter downgraded Node.js from v24.12.0 to v22.22.0, cleared ~/.claude/session-env, and tested 2.1.27 again. Still crashed; rolling back to 2.1.25 was stable.

      Source: https://github.com/anthropics/claude-code/issues/22042#issuecomment-3825962837 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @Profreshor tried on GitHub (Outcome unclear)

      Commenter found session JSONL files with many saved_hook_context records and suspected plugin hooks were writing duplicates. Deleting those session files was suggested as a workaround.

      Source: https://github.com/anthropics/claude-code/issues/22042#issuecomment-3826144733 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @Profreshor tried on GitHub (Outcome unclear)

      Commenter provided grep and count commands to find JSONL files with saved_hook_context, then suggested deleting the files or moving ~/.claude to ~/.claude.backup.

      Source: https://github.com/anthropics/claude-code/issues/22042#issuecomment-3826200674 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @Profreshor tried on GitHub (Outcome unclear)

      Commenter observed that the memory blow-up happened when a second concurrent Claude Code session was launched, and that a single session stayed around 500MB.

      Source: https://github.com/anthropics/claude-code/issues/22042#issuecomment-3825991126 (opens external site)

      Did this work for you?

    Add your answer or comment