Skip to content
BENIBIX Learn

CLAUDE_CODE_TOOL_MEMORY_LIMIT

AI⌨️ Claude CodeConfiguration

Also known as CLAUDE_CODE_TOOL_MEMORY_LIMIT environment variable

It caps how much memory Claude's commands can use.

Think of it like

It is like a big game on a small table. It may only use part of it.

Example

Jack's build once ate all his memory and froze the laptop. He sets a 4G cap, so a runaway command is stopped first.

Why it matters

One command that eats all the memory can freeze the whole machine.

Definition

CLAUDE_CODE_TOOL_MEMORY_LIMIT caps the memory that Bash and PowerShell commands can use, on Linux and WSL. Write a size such as 4G, or a plain number of bytes. Set 0 or off to turn the cap off. A changed value takes effect the next time you start claude. It needs version 2.1.233 or later.

Example code

bash
export CLAUDE_CODE_TOOL_MEMORY_LIMIT=4G
claude
Keep each command under 4 GB.

Common mistake

Expecting it to work on a Mac. It only works on Linux and WSL.

Key takeaways

  1. 1
    Size like 4G. Or bytes.
  2. 2
    0 or off. No cap.
  3. 3
    Linux and WSL. Next start.