Memory / VRAM

CUDA out of memory

torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate … (GPU 0; … total capacity)

ComfyUI ran out of GPU VRAM while loading a model or sampling. Almost always fixed by lowering memory pressure, not by buying a bigger GPU.

What it means

This error means your GPU does not have enough free VRAM to hold everything the current run needs at once — the checkpoint, any LoRAs and ControlNets, the latent, and the working tensors during sampling or VAE decode. PyTorch asks the GPU for a block of memory, the GPU cannot provide it, and the run aborts.

It is a capacity problem, not a corruption problem: the same workflow that fails at high resolution or batch size will usually succeed once you reduce what has to be resident at the same moment, or free VRAM left behind by a previous run.

Common causes

  • Resolution or batch size too high for your VRAM.
  • Multiple large models resident at once (checkpoint + several LoRAs/ControlNets/upscalers).
  • VRAM from a previous generation was never released (common after an earlier crash).
  • A large image passed to a full-frame VAE decode instead of a tiled one.

How to fix it

  1. 1

    Lower resolution and batch size

    Drop the batch size to 1 and reduce width/height (for SDXL, generate near 1024×1024 and upscale afterwards rather than sampling at very high resolution directly).

  2. 2

    Launch ComfyUI with a lower-VRAM mode

    Restart with a memory flag such as --lowvram or --medvram (use --novram only as a last resort). These offload parts of the model to system RAM at the cost of speed.

  3. 3

    Use tiled VAE decoding

    Swap a full VAEDecode for a tiled decode so the image is decoded in chunks — VAE decode is a common OOM spike at high resolution.

  4. 4

    Reduce concurrent models and use lower precision

    Remove unused LoRAs/ControlNets from the graph and prefer fp16/fp8 model weights where supported to halve the memory footprint.

  5. 5

    Restart to reclaim leaked VRAM

    If VRAM was not freed after a prior crash, fully restart the ComfyUI server (not just the browser) to reset GPU memory to a clean state.

Once a workflow runs cleanly at a given VRAM setting, capturing that exact node graph and its parameters means you can reproduce the working configuration later instead of re-discovering it by trial and error.

Frequently asked questions

Frequently Asked Questions

Quick answers to the most common questions.

Related nodes

Related errors

Make every ComfyUI run reproducible

Numonic captures the full workflow behind each ComfyUI generation — models, samplers, seeds, prompts, and custom nodes — so a setup that finally works is one you can find and rebuild, not re-debug.