Rescue OpenClaw stuck? Gateway, auth, tunnel, and VPS troubleshooting. Get help →
← Back to Blog

Fix OpenClaw / Ollama Out of Memory: "killed", OOM, Model Won't Load

A deep-dive on out-of-memory errors running local models in OpenClaw: process killed, CUDA OOM, or the model refusing to load. Part of the OpenClaw troubleshooting hub.

Stuck on this? Get 1:1 OpenClaw help

Remote rescue for model loading, memory, quantization, and hardware-fit problems. See the rescue session →

If your local model gets killed, throws CUDA out of memory, or simply refuses to load, the model plus its KV cache didn’t fit in memory. The fast fixes are: drop to a smaller quantization, shrink the context window, and close other apps. If the model still won’t fit, the machine genuinely doesn’t have enough memory for that model, and this page shows the upgrade ladder.

Error: llama runner process has terminated: signal: killed
CUDA error: out of memory

Why this happens

Running a model locally has to hold two things in memory at once:

  1. The weights — roughly 0.6 GB per billion parameters at Q4_K_M. A 27B model is ~16-18 GB; a 70B is ~40 GB.
  2. The KV cache — grows with your context window. A large context (32K+) can add several GB on top of the weights.

When weights + KV cache exceed your available RAM (CPU/unified memory) or VRAM (discrete GPU), the OS kills the process or CUDA reports out of memory. The why-is-my-local-llm-so-slow guide covers the sibling problem where a model fits but crawls; this page is about when it doesn’t fit at all.

Fixes that don’t cost anything

1. Drop the quantization

Q4_K_M is the sweet spot for coding models: much smaller than Q5/Q8, with minimal quality loss. If you’re on Q5, Q6, or Q8, switch to Q4_K_M and you’ll often reclaim several GB.

# Pull the Q4_K_M variant instead of a larger quant
ollama pull qwen3:27b-q4_K_M

2. Shrink the context window

The KV cache is the hidden memory hog. If the weights fit but you OOM partway through a long conversation, your context is the culprit. Drop it to something that fits in the memory you have left after weights (e.g. 8K-16K).

# Lower the context OpenClaw requests from the local model
openclaw config set agents.defaults.context 16384

3. Free memory before loading

  • Close browsers, IDEs, and other heavy apps, they eat the RAM the model needs.
  • On a discrete GPU, make sure nothing else is using VRAM (nvidia-smi shows what’s resident).
  • Use /new in OpenClaw to reset a bloated session instead of letting context grow unbounded.

4. Pick a model that fits your tier

If a 70B keeps OOM-ing on a 24 GB machine, it’s the wrong model for the hardware. Use the best local LLM by RAM and best local LLM by GPU guides to pick a model that fits, a well-chosen 27B-32B at Q4 beats a 70B you can’t load.

When the model genuinely needs more memory

Sometimes the model you want is simply bigger than the machine you have. If you’ve dropped to Q4, cut context, and freed memory and it still won’t fit, that’s a hardware-fit problem, not a config bug. Here’s the upgrade ladder for local OpenClaw work, matched to what each tier can actually load.

🖥️ THE UPGRADE LADDER — RIGS THAT ACTUALLY FIT THE MODEL

Pick the tier that fits the model you keep OOM-ing on. 24 GB (RTX 3090 or a 24 GB Mac) runs 27B-class models at Q4; 48 GB+ Macs handle bigger models; a 96 GB workstation card runs 70B-plus at long context.

Rough fit guide: 24 GB loads 27B-class models at Q4 with room for moderate context. 48 GB opens up larger models and longer context. 96 GB (the RTX PRO 6000 Blackwell) is workstation territory for 70B-plus at long context without quantizing to death. Match the tier to the model you actually keep failing to load, not the biggest number.

Quick reference

Symptom Cause First fix
signal: killed on loadWeights exceed RAM/VRAMDrop to Q4_K_M
CUDA out of memoryModel + KV cache > VRAMLower context window
OOM only in long chatsKV cache grew with context/new + shrink context
Won't fit after all fixesModel bigger than machineStep up a hardware tier

Need help?

If you’re not sure whether to re-quantize, cut context, or upgrade, we offer a fixed-scope remote rescue session that includes a hardware-fit review. See OpenClaw troubleshooting help →

Get guides like this in your inbox every Wednesday.

No spam. Unsubscribe anytime.

You'll probably need this again.

Press Cmd+D (Mac) or Ctrl+D (Windows) to bookmark this page.

Need OpenClaw fixed live?

Remote rescue sessions for gateway, auth, tunnel, VPS, and model access problems.

See Rescue Session

Next useful step

Read next

Fix OpenClaw "Bundled Chrome Extension Is Missing"
Fix the OpenClaw error "bundled Chrome extension is missing". Install the extension files, find the folder path, and load it unpacked in Chrome Developer mode.
Fix OpenClaw Docker "Missing config" / Gateway Won't Start
Fix the OpenClaw Docker error "Missing config. Run openclaw setup or set gateway.mode=local". Initialize gateway.mode, gateway.bind, and restart the container.
Fix OpenClaw macOS: Gateway Won't Stay Running / Telegram Bot Silent
Fix OpenClaw on macOS: gateway dies when you close the terminal, and the Telegram bot stops responding. Install the launchd service and fix binding + permissions.