ollama - 💡(How to fix) Fix [Regression 0.20.x] memory layout cannot be allocated for all models >10 GB on Windows — GPU abandoned after vision encoder CPU buffer allocation failure [10 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
ollama/ollama#15352Fetched 2026-04-08 02:52:20
View on GitHub
Comments
10
Participants
2
Timeline
11
Reactions
0
Timeline (top)
commented ×10cross-referenced ×1

Error Message

| Model | Size | Error |

Fix Action

Fix / Workaround

Workarounds attempted

RAW_BUFFERClick to expand / collapse

Environment

  • OS: Windows 10 Home 22H2 (build 19045)
  • GPU: NVIDIA RTX 3090 24 GB (CUDA 12.x)
  • Ollama version: 0.20.2 (auto-updated ~April 5 2026)
  • Previously working version: 0.19.x

Affected models (all fail)

ModelSizeError
qwen3.5:35b-a3b-q4_K_M~23 GBmemory layout cannot be allocated
qwen3.5:35b-8k~23 GBmemory layout cannot be allocated
gemma4:31b~19 GBmemory layout cannot be allocated

Working model

  • gemma4:e2b (7.2 GB) — loads and runs correctly

Observed behaviour

When loading any model larger than ~10 GB, Ollama logs show:

  1. Vision encoder tensors load to GPU successfully
  2. A subsequent CPU buffer allocation (~20 MB) fails with
  3. Ollama then falls back to CPU-only mode ()
  4. CPU RAM is insufficient for the full model → generation fails or produces garbage

The model never recovers GPU access once the CPU fallback is triggered. Restarting Ollama does not help.

Workarounds attempted

  • Restarting the Ollama service
  • Running Ollama in an interactive desktop session (not Session 0) to ensure GPU access
  • Reducing to 8192
  • Pulling the model fresh

None resolved the issue. The 7.2 GB model works, confirming the GPU is functional.

Regression

This worked correctly on Ollama 0.19.x. The issue appeared immediately after an automatic update to 0.20.2.

Additional info

The failure appears to be in memory layout/planning for large models — specifically a CPU staging buffer allocation that regressed in 0.20.x. Once that allocation fails, the GPU is abandoned entirely for the session.

extent analysis

TL;DR

Downgrade to Ollama version 0.19.x to potentially resolve the memory layout allocation issue for large models.

Guidance

  • Verify that the issue is indeed related to the CPU staging buffer allocation by checking the Ollama logs for the specific error message "memory layout cannot be allocated".
  • Attempt to allocate more CPU RAM or reduce the model size to see if it mitigates the issue.
  • Consider reporting the bug to the Ollama developers, as the issue appears to be a regression introduced in version 0.20.2.
  • Check if there are any other workarounds or fixes available for version 0.20.2, such as configuration changes or environment variable tweaks.

Notes

The issue seems to be specific to large models (>10 GB) and is likely related to a change in memory management in Ollama version 0.20.2. Downgrading to version 0.19.x may resolve the issue, but it's unclear if this will introduce other problems or compatibility issues.

Recommendation

Apply workaround: Downgrade to Ollama version 0.19.x, as it is the last known working version for large models, and the current version (0.20.2) has introduced a regression that causes the memory layout allocation issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING