Stable Diffusion CUDA Out of Memory Error
Workaround available Windows, Linux (NVIDIA GPUs) Updated November 14, 2026Based on 4 user reportsHow we research
Quick answer
The GPU ran out of VRAM for the image size, batch or model you chose. Lowering resolution and batch size, or launching with --medvram or --lowvram, usually fixes it.
Most likely fix: Lower the memory load
How to fix it
Try these in order — the most common fix is first.
1. Lower the memory load
- Reduce width and height (generate at 512x512 or 768x768, then upscale)
- Set Batch size to 1 and use Batch count instead
- Disable or lower Hires fix scale
Did this fix it?2. Add low-VRAM launch flags
- Open webui-user.bat (Windows) or webui-user.sh in a text editor
- Set COMMANDLINE_ARGS=--medvram (use --lowvram for 4 GB cards or less)
- Save and restart the web UI
Did this fix it?3. Tune the allocator and free VRAM
- Close browsers with GPU acceleration, games and other AI tools
- Set the PYTORCH_CUDA_ALLOC_CONF environment variable as suggested in the error message
- If it still fails, use a smaller model (SD 1.5) or a cloud GPU
Did this fix it?
Symptoms
Generation stops with 'torch.cuda.OutOfMemoryError: CUDA out of memory' (or 'Tried to allocate X MiB'), often at high resolution, during hires fix, upscaling or when loading SDXL.
Why it happens
- Image resolution or batch size too large for the card's VRAM
- SDXL or large models on a 4-6 GB GPU
- Hires fix or upscaler multiplying the working resolution
- Other programs (browser, games) holding VRAM
This guide also covers
- stable diffusion cuda out of memory
- stable diffusion out of memory error
- automatic1111 cuda out of memory
Still not working?
If Stable Diffusion keeps failing, you're not alone. See every Stable Diffusion problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
All not loading, error messages & connection guides →
Midjourney Job Failed or Internal Server Error (Midjourney)
Other Stable Diffusion errors
- Stable Diffusion "Torch is not able to use GPU" Error
- Stable Diffusion Black Images and NaN Error
- Stable Diffusion Model Failed to Load, Exiting
- Stable Diffusion Very Slow on Mac (M1, M2, M3)
- Stable Diffusion Not Using AMD GPU (Slow, CPU Only)
- Stable Diffusion xformers Error After Update
- Stable Diffusion "Couldn't install torch" Error
- Stability AI API 402 Insufficient Credits Error