Ollama 'Model Requires More System Memory': The Fix
What Ollama's two memory numbers actually measure, why Docker and WSL report less than you have, which versions show this error, and how to fix it.
By Cogniq Labs ResearchEvidence policy

The full message looks like this:
Error: model requires more system memory (8.4 GiB) than is available (6.1 GiB)
The first number is not the size of the model. It is the part Ollama would have to keep in system RAM. The second is the free RAM plus free swap that Ollama could see. To fix it you either shrink the first number or raise the second. The numbers above are an example; yours show how far apart you are.
Which versions show this
This is worth checking first, because it changes the advice. The message appears in the source of Ollama 0.24 and earlier releases. Releases from 0.30 onwards moved to a different engine, and the message is not in them.
ollama --version
If you are on 0.24 or earlier, updating is a reasonable first step. If you cannot update, or want to understand the check, the rest of this note explains it. Newer versions handle shortages differently: in the current scheduler, if loading fails because memory ran out and Ollama chose the context length itself, it lowers the context, to 32,768 or 4,096 tokens, and tries once more. A context length you set yourself is not reduced. If a newer version still fails, you will see a process terminated error instead.
What the two numbers are
In the versions that print this message, the check works like this.
The required figure is the memory for everything that will run on the CPU: the layers that do not go to a GPU, plus the working memory the CPU side needs. If your GPU holds part of the model, only the rest counts. If no GPU is used, the whole model counts.
The available figure on Linux and Windows is free system memory plus free swap. On macOS this check is not applied, because macOS manages swap dynamically.
So three things decide the outcome: how big the model and its context are, how much of it the GPU takes, and how much free RAM and swap exist right now.
How Linux, containers and WSL change "available"
On Linux, Ollama reads free memory from /proc/meminfo, using MemAvailable, which already counts cache the system can give back. This matters, because a common claim is that file cache makes Ollama think memory is used. On a normal Linux host, MemAvailable accounts for that.
Containers are different. The same file also reads the container's memory limit, and when there is one, it takes free memory to be the limit minus current usage. Current usage in a Linux control group includes file cache. A container that has just read a large model file can therefore appear to have much less free memory than it really could use.
| Where Ollama runs | What limits "available" | Check |
|---|---|---|
| Directly on Linux | Free RAM plus free swap | free -h and look at the "available" column |
| Docker with a memory limit | The container limit minus usage | docker stats and the --memory setting |
| Docker Desktop | The memory given to Docker's virtual machine | Docker Desktop resource settings |
| WSL2 on Windows | The memory given to the WSL virtual machine | The memory setting in .wslconfig |
If the second number in your error is suspiciously round, such as exactly 4 or 8 GiB on a 32 GB computer, a limit like these is the likely reason.
Get the full picture from the log
The terminal shows two numbers. The server log shows more. In the versions with this message, the code writes a warning just before it fails, beginning model request too large for system, with these values:
| Field | What it tells you |
|---|---|
requested |
What would need to sit in system memory |
available |
Free memory plus free swap |
total |
All the memory Ollama believes the system has |
free |
Free memory alone |
swap |
Free swap alone |
total is the most revealing field. If it is far below the memory in your computer, Ollama is running inside a limit: a container, a virtual machine or WSL. If total is right but free is small, something else is using your memory. If swap is zero, you have no cushion at all.
On Linux with the standard install, read it with:
journalctl -u ollama --no-pager | grep -i "too large for system"
Locations for other systems are in the Ollama documentation, and for containers it is docker logs <container-name>.
Fix 1: make the model need less
This is usually the cleanest fix.
- Use a smaller or more compressed model. A lower quantization of the same model needs much less memory. We cover the cost in what quantization actually costs you.
- Shorten the context. The context cache grows with its length. Set
OLLAMA_CONTEXT_LENGTH, ornum_ctxfor one model, to what you actually need, as described in Ollama context length. - Run one request at a time.
OLLAMA_NUM_PARALLEL=1avoids reserving context for several.
Fix 2: make sure the GPU is being used
If you have a GPU and the required number is close to the whole model size, the GPU is probably not taking any layers. Run:
ollama ps
If the processor column says CPU, follow why Ollama uses the CPU instead of the GPU. Getting the GPU working moves layers out of system memory and may remove the error without any other change.
Fix 3: free memory, or give Ollama more
- Unload other models with
ollama stop <model>, and close browsers and other large programs. - In Docker, raise or remove the
--memorylimit. - In Docker Desktop or WSL2, raise the memory given to the virtual machine, then restart it. For WSL2, that is a setting in the
.wslconfigfile in your Windows user folder:
[wsl2]
memory=16GB
Run wsl --shutdown afterwards so the change takes effect.
Fix 4: add swap
Because free swap counts, adding it can let a model load. On Linux, for example:
sudo fallocate -l 8G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
Understand the trade. Swap is disk, and disk is far slower than RAM. A model that spills into swap while running will generate very slowly. This is a way to get a model to start, or to cover a small shortfall, not a way to run a model that is much too large. The commands above last until reboot unless you add the file to /etc/fstab.
A worked example
Illustrative figures, to show the reasoning:
| Situation | Required | Available | What to do |
|---|---|---|---|
| Laptop, no GPU, 8B model at a long context | 8.4 GiB | 6.1 GiB | Shorten the context or use a smaller quantization |
| Desktop with a GPU that was not detected | 20 GiB | 14 GiB | Fix GPU detection first |
| Docker with a 4 GiB limit | 5.5 GiB | 1.2 GiB | Raise the container limit |
| Slightly short on a Linux server | 17 GiB | 15 GiB | Add swap, or unload another model |
Related messages
In the same versions, you may see in the log that a model "requires more system memory than is currently available, evicting a model to make space". That is not the failure. Ollama is unloading another model to make room. The error you see in the terminal appears only when nothing more can be freed.
If your error mentions GPU memory or CUDA instead, it is a different problem: see why Ollama runs out of memory.
Stopping it from coming back
- Know your budget. Free memory plus swap, minus a margin for the rest of the system, is what the CPU side of a model may use.
- Pick models by size on disk as a first filter. A model file larger than your free memory will not fit without a GPU taking a large share.
- Set the context deliberately for each model you use, instead of accepting a large default.
- Unload between big models. If you switch between two large ones, stop the first.
Finally, keep the numbers from the message when it happens again. Two readings taken on different days show whether the requirement grew, because of a new model or a longer context, or the available memory shrank, because something else started using it. Those two cases have different fixes.
What we do not know
We read the source rather than testing on hardware. How the required figure is estimated differs between releases, so the same model can pass on one version and fail on another. Containers and virtual machines report memory in ways that depend on their configuration, so if the numbers still make no sense, set OLLAMA_DEBUG=1 and read what Ollama logs about system memory just before the error.
Sources
Frequently asked questions
What does "model requires more system memory than is available" mean?
Ollama worked out how much of the model would have to sit in system RAM and found it larger than the free RAM plus free swap, so it refused to load. The first number is the part that would use system memory, and the second is what Ollama counted as available.
Why does Ollama say I have less memory than my computer has?
It counts only what is free at that moment, plus swap. In Docker or WSL2 it also sees only the limit of the container or virtual machine, and inside a container with a memory limit, file cache can count as used.
Why is Ollama using system memory when I have a GPU?
The first number includes every layer that does not fit on the GPU. If the GPU was not detected, the whole model counts against system memory. Run ollama ps and check the server log to see whether the GPU was found.
Does adding swap fix the error?
On Linux and Windows the check counts free swap, so adding swap can let the model load. It will be slow if the model actually runs out of swap, so treat it as a way to get running, not a performance fix.
Why do newer Ollama versions not show this error?
The message exists in releases up to the 0.24 line. Releases from 0.30 use a different engine that does not contain it. When a load fails for lack of memory and the context length was chosen automatically, current code retries once with a smaller context.
Related reading
llama.cpp 'Failed to Fit Params': What It Means
The failed to fit params line in llama.cpp is a warning, not the crash. What the fit step adjusts, what each reason means, and which flags to change.
Why Ollama Is Slow Even When It Runs on the GPU
Slow Ollama replies on a GPU come from loading, reading the prompt or writing the answer. How to measure each with Ollama's own timings, and what to change.
Why Ollama Is Using the CPU Instead of Your GPU
When Ollama runs on the CPU, the cause is a driver, a container, a card Ollama does not support, or a model too big for the GPU. How to tell which, and fix it.