ThinkFacility

Error messages

torch.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)

The message

torch.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)
ComfyUI 0.37.0 read September 25, 2026ComfyUIPyTorchVRAMout of memory

What it means

A node asked PyTorch for more graphics card memory (VRAM) than was free, and the request failed. It's the same out-of-memory error most people know as “CUDA out of memory”, printed by the allocator ComfyUI turns on by default.

What to do

Lower the resolution, batch size or video length, or pick a smaller or quantized model. If the same workflow ran on an older ComfyUI, update first, then try the launch flags below.

This one turns up in the ComfyUI console, and in the error panel on the node that was running, partway through a generation:

!!! Exception during processing !!! Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated     : 4.89 GiB
Requested               : 6.24 GiB
Device limit            : 23.99 GiB
Free (according to CUDA): 2.49 GiB
...
torch.OutOfMemoryError: Allocation on device 0 would exceed allowed memory. (out of memory)

Those figures are from a real log in issue #16175. The request was 6.24 GiB and the card had 2.49 GiB free, so PyTorch (the library ComfyUI does its GPU work in) gave up. "Device 0" is your first graphics card. It's a very common paste: 189 issues in the ComfyUI repo contain "Allocation on device" as of September 25, 2026.

Why it doesn't say "CUDA out of memory"

We went looking for this string in ComfyUI and it isn't there. It lives in PyTorch's CUDAMallocAsyncAllocator.cpp, the code behind an optional way of handing out VRAM (cudaMallocAsync). ComfyUI switches that allocator on by default for CUDA builds of PyTorch 2 and newer (in cuda_malloc.py), so ComfyUI users see this wording where most PyTorch users see CUDA out of memory. Tried to allocate. Both mean the card is full. The "allowed memory" in the message isn't a limit you set somewhere.

Newer PyTorch builds add one more line, PyTorch limit (set by user-supplied memory fraction). That's only relevant if something called PyTorch's memory fraction setting, which ComfyUI doesn't do on its own.

What ComfyUI does after it

ComfyUI 0.37.0 catches the error, adds a tip to it ("This error means you ran out of memory on your GPU", plus a note that an accidentally large batch_size is a common cause), logs Got an OOM, unloading all loaded models. and throws every model out of VRAM. The next run starts clean, so it's worth one retry before you change anything. Recent versions of the web interface label the same failure "Generation failed" and say "Not enough GPU memory. Try reducing image resolution or batch size and run again."

Getting the run through

The fixes that work are the ones that shrink the job. Lower the width and height, set the batch size back to 1, cut the frame count on video models, or switch to an fp8 or GGUF version of the model (smaller files that need less VRAM).

Launch flags help at the margins. --reserve-vram 1 keeps a gigabyte back for Windows and other apps. --disable-cuda-malloc goes back to PyTorch's default allocator, which changes the wording to "CUDA out of memory" but won't make a job that's too big fit. --lowvram is a no-op on current builds (its help text says it does nothing while dynamic VRAM is on), which surprised us given how often it's still recommended.

When a workflow that used to fit stops fitting

That's worth reporting, because ComfyUI's memory handling changes often. In September 2026 several issues (#16144, #16175, #16335) reported new out-of-memory failures around the MiniMax H3 video models after a model compiler landed. comfyanonymous, ComfyUI's creator, replied on #16175 on September 9: "Should be fixed now." Some users still hit it a step later, and one suggested launching with --disable-comfy-compiler, a flag that exists in 0.37.0 and turns that compiler off. If an update caused it, that flag and --disable-dynamic-vram are the two to try, and the issue tracker wants the full log including the memory table ComfyUI prints.

Other lines the same feature prints

Match yours against these if the one at the top of the page is not quite it. They come from the same code and mean related things.

  • Allocation on device 0 would exceed allowed memory. (out of memory)
  • !!! Exception during processing !!! Allocation on device 0 would exceed allowed memory. (out of memory)
  • This error means you ran out of memory on your GPU.
  • Got an OOM, unloading all loaded models.
  • Not enough GPU memory. Try reducing image resolution or batch size and run again.
  • CUDA out of memory. Tried to allocate