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:
- The weights — roughly
0.6 GB per billion parametersatQ4_K_M. A 27B model is ~16-18 GB; a 70B is ~40 GB. - 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-smishows what’s resident). - Use
/newin 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.
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 load | Weights exceed RAM/VRAM | Drop to Q4_K_M |
CUDA out of memory | Model + KV cache > VRAM | Lower context window |
| OOM only in long chats | KV cache grew with context | /new + shrink context |
| Won't fit after all fixes | Model bigger than machine | Step up a hardware tier |
Related OpenClaw guides
- Back to the full OpenClaw troubleshooting hub for all errors.
- Model fits but runs slow? See why is my local LLM so slow.
- Picking a model that fits your memory: best local LLM by RAM and by GPU.
- Tools failing instead of OOM? See tools not working / NO_REPLY.
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