A CUDA out-of-memory error means the current job asked for more GPU memory than was available. The cause can be image resolution, batch size, a large model, Hires fix, multiple ControlNets, an upscaler, an extension, or another application using VRAM. Lower one variable at a time so you know what solved it.

Downloads and Official References#

Use the documentation for your interface. A launch option from AUTOMATIC1111 does not automatically apply to ComfyUI, Forge, or another frontend.

Record the Failing Job#

Before changing settings, record:

  • GPU model and dedicated VRAM;
  • checkpoint or diffusion model;
  • width and height;
  • batch size and batch count;
  • Hires fix or upscale settings;
  • ControlNet, IP-Adapter, AnimateDiff, or other extensions;
  • VAE and precision options;
  • the full error text.

Save the seed and prompt if you want to compare output after reducing memory use.

Run a Minimal Baseline#

  1. Restart the interface.
  2. Close games, video tools, 3D tools, and other GPU-heavy applications.
  3. Load one normal checkpoint.
  4. Disable Hires fix and all extensions.
  5. Set batch size to 1.
  6. Use a modest native resolution for the selected model.
  7. Generate one image.
  • Baseline works: add features back one at a time.
  • Baseline fails: check model size, backend, precision, low-VRAM mode, and GPU support.

Reduce the Largest Memory Multipliers#

Use this order:

  1. Set batch size to 1.
  2. Reduce width and height.
  3. Disable Hires fix.
  4. Disable high-resolution preview or live preview.
  5. Remove extra ControlNet or adapter units.
  6. Use a lighter upscaler or upscale after generation.
  7. Switch to a smaller compatible model.

Width and height multiply each other. A small increase in both can create a much larger memory request.

Batch count usually runs jobs sequentially. Batch size processes images together and uses more VRAM. Use batch count when you need several images but cannot fit them at once.

Use Supported Low-VRAM Options#

AUTOMATIC1111 provides options such as --medvram, --medvram-sdxl, and --lowvram. The current troubleshooting page explains the tradeoff between memory and speed.

On Windows, edit the existing COMMANDLINE_ARGS line in webui-user.bat. Do not add several contradictory lines copied from old guides.

Start with the option documented for your GPU and model. Restart the WebUI and confirm the startup log shows the option.

For ComfyUI, use the memory options documented for the current build. Do not copy AUTOMATIC1111 flags into a ComfyUI command.

Check Other GPU Memory Users#

Run:

nvidia-smi

Look for other processes using dedicated GPU memory. Close only applications you recognize. A browser, game launcher, 3D renderer, video editor, or another AI server can hold several gigabytes.

If VRAM remains occupied after a failed job, stop the current model or restart the AI interface. Reboot only when the process cannot release the allocation normally.

Isolate Extensions#

Extensions can keep models in memory or add large intermediate tensors.

  1. Disable all optional extensions.
  2. Confirm the minimal job works.
  3. Enable one extension.
  4. Repeat the same seed and settings.
  5. Continue until the failure returns.

Then lower that extension’s model size, resolution, cache, frame count, or unit count according to its documentation.

Avoid Misleading Fixes#

  • Reinstalling the interface does not increase VRAM.
  • Increasing the Windows page file adds system-memory safety, not dedicated GPU memory.
  • torch.cuda.empty_cache() cannot free tensors still used by a running workflow.
  • A different sampler rarely solves a large resolution or batch-size mismatch by itself.
  • Random memory allocator settings should not replace reducing a job that cannot fit.
  • Disabling safety checks or forcing unsupported precision can create different failures.

Verify the Fix#

  1. Run the minimal baseline twice.
  2. Add the required model and extensions one at a time.
  3. Monitor peak dedicated GPU memory.
  4. Confirm that the final settings complete after a restart.
  5. Save the working launch options and generation parameters.

The fix is stable when the required workflow completes repeatedly with some VRAM headroom. A single successful run at the absolute limit may fail when another application, preview, or larger prompt uses additional memory.