A JOURNAL OF ARTIFICIAL INTELLIGENCE
my ai daily

ComfyUI Out of Memory Fix: DynamicVRAM & Batch Leaks

ComfyUI’s 2026 DynamicVRAM and AIMDO allocator made pre-March --lowvram flags useless—introducing second-run non-OOM crashes, WSL Shared GPU memory locks, and HostBuffer errors. Here is the symptom-by-symptom CLI and BatchPipe fix.

AI-generated editorial illustration showing smoked-glass compute nodes feeding cyan and amber light conduits through three stacked matte-black GPU memory modules, with a brass relief valve venting excess amber flow into a buffer manifold.
AI-generated illustration / my ai dailyIllustrative image.

THE STORY IN THREE POINTS

  • Legacy --lowvram flags no longer fix most 2026 ComfyUI crashes: upstream option definitions confirm --lowvram has no effect while DynamicVRAM is enabled, and --reserve-vram is silently ignored in favor of --vram-headroom N.
  • For second-generation crashes (VRAM Allocation failed (non OOM) on QwenImage), HostBuffer.read_file_slice CUDA errors, or WSL pinning models into slow Shared GPU memory, pass --disable-dynamic-vram and cap RAM buffers with --cache-ram 4.
  • For 500-frame animation queues and long batches that crash near completion from gradual tensor accumulation, update the BatchPipe custom node (November 17, 2026 release) and enable Empty VRAM Cache to flush PyTorch memory after each iteration.

Why pre-March 2026 --lowvram guides fail under DynamicVRAM and AIMDO

If you updated ComfyUI in mid-to-late 2026 and found classic memory flags doing nothing, the underlying memory manager changed. ComfyUI replaced static upfront memory estimation with DynamicVRAM backed by the comfy-aimdo allocator, which streams model blocks dynamically between host RAM and VRAM. As 42 UK’s November 8 low-VRAM troubleshooter points out, ComfyUI’s current upstream option definitions explicitly state that --lowvram has no effect while DynamicVRAM is active.

The same architectural shift broke another staple launch flag: Local AI Master’s DynamicVRAM audit documents that --reserve-vram is accepted silently at startup and ignored under DynamicVRAM (issue #15666), having been superseded by --vram-headroom N (PR #14480). Worse, DynamicVRAM relies on rapid paging, so keeping safetensors weights on a mechanical HDD instead of an NVMe SSD creates severe stall-and-timeout pseudo-OOM failures.

Symptom-to-fix tree: non-OOM second-run crashes and HostBuffer exhaustion

Symptom 1 — First generation succeeds, second generation crashes with VRAM Allocation failed (non OOM) and Fault failed: 2: Tracked in ComfyUI issue #15269 (AIMDO 0.4.11, frequently hitting QwenImage workflows, echoing March’s #12943), this is an allocator state regression rather than actual capacity exhaustion. Add --disable-dynamic-vram to python main.py or your Windows run_nvidia_gpu.bat launch line so ComfyUI reverts to deterministic estimation-based loading (where --lowvram also regains effect).

Symptom 2 — HostBuffer.read_file_slice failed followed by torch.AcceleratorError: CUDA error: out of memory, or climbing system RAM on LoRAs: Reported heavily in issue #15255, streaming failures respond immediately to --disable-dynamic-vram (adding --cuda-device 0 or --disable-pinned-memory on multi-GPU hosts). If host RAM climbs across LoRA-heavy prompts (#15575), cap host caching with --cache-ram 4; if you hit RuntimeError: HostBuffer.truncate failed inside partially_unload_ram on comfy-kitchen 0.2.31 (seen with MiniMax H3), pin pip install comfy-kitchen==0.2.30.

WSL Shared GPU memory locks and 8GB–12GB Tiled VAE decode relief

Symptom 3 — Generation slows by 10x inside WSL while Task Manager shows Shared GPU memory maxed out: Issue #15679 confirms DynamicVRAM on WSL can pin an entire model stack into Windows Shared GPU memory (system RAM mapped over PCIe) instead of dedicated VRAM. Launch with --disable-dynamic-vram—or pass --gpu-only when your entire diffusion and text-encoder stack fits cleanly inside GPU memory.

Symptom 4 — Crash right at the end of sampling during image decode on 8 GB–12 GB GPUs: Isolate whether failure hits during model loading, KSampler execution, or final VAE decode. For decode OOMs on large image models covered in our FLUX.2 vs Qwen-Image VRAM guide or MiniMax H3-Image analysis, swap in a Tiled VAE Decode node (tile_size=512, overlap=64) alongside memory-efficient attention backends such as SageAttention.

Fixing 500-frame video and batch VRAM leaks with BatchPipe Empty VRAM Cache

Ambitious animation queues and 500-frame video workflows suffer a separate failure mode from DynamicVRAM: silent inter-frame memory creep where lingering PyTorch allocator blocks accumulate until frame 499 throws an OOM. As detailed in MyUP’s November 17 batch VRAM leak guide, an update to the BatchPipe custom node directly resolves this leak.

Install or update BatchPipe via ComfyUI-Manager, wire the node directly ahead of your Save Image or Video Combine output stage, and enable its Empty VRAM Cache checkbox to force PyTorch to purge retained cache tensors between every batch step. Pair that hygiene with quantized video checkpoints detailed in our local video generation VRAM guide and hardware headroom sizing in our GPU VRAM buyer’s guide and live benchmarks hub.

Sources: ComfyUI Out of Memory: HostBuffer & DynamicVRAM Fix|Local AI Master ↗ ComfyUI Out of Memory? RAM & VRAM Troubleshooter|42 UK ↗ ComfyUI batch generation VRAM leak fix: a practical guide|MyUP ↗ Issue #15255: Dynamic VRAM streaming crashes with HostBuffer.read_file_slice failed|Comfy-Org/ComfyUI ↗ Issue #15269: DynamicVRAM + AIMDO 0.4.11 VRAM Allocation failed (non OOM)|Comfy-Org/ComfyUI ↗ Issue #15679: DynamicVRAM on WSL pins model set into Shared GPU memory|Comfy-Org/ComfyUI ↗

THE BROADER CONTEXT · FRONTIER LABS DOSSIER

Explore full product specifications, pricing analysis, and continuous coverage in the Frontier Labs Desk Hub and Others Dossier. Independent benchmarks available on the AI Intelligence Index and Coding Agents Leaderboard.

02The next story

News

Ollama Context Length: Why It Caps at 4K & How to Fix It

Ollama silently locks context at 4,096 tokens on machines under 24 GiB VRAM—and setting OLLAMA_NUM_CTX or passing num_ctx to /v1/chat/completions does nothing. Here is the OLLAMA_CONTEXT_LENGTH fix and how to verify it with ollama ps.

Best Local LLM for Coding: Picks by 16GB, 24GB & 64GB

Autocomplete-only models crash inside Cline, Aider, and OpenCode. Filtering strictly for native Ollama tool calling and permissive open weights yields clear November 2026 picks across 16GB, 24GB/32GB, and 64GB+ workstations.

OpenClaw Alternatives: Safer Self-Hosted AI Agents Tested

OpenClaw passed 361K+ GitHub stars—and Bitsight spotted over 30,000 exposed instances probing port 18789. Here is how security-first open replacements like Hermes Agent, NanoClaw, NullClaw, and OpenFang compare against managed sandboxes like Claude Duet and Manus.

Follow your curiosity.

EXPLORE THE ARCHIVESOURCES & CONTEXT INCLUDED