The "VRAM Traffic Controller" for ComfyUI. Smart Edition: Invisible when safe, lifesaving when critical.
Solves OOM (Out of Memory), CUDA Errors, and System Freezes when running massive models (Flux/Qwen/Wan2.2) with ControlNet on limited VRAM (12G/16G/24G).
🧐 The Problem
Even with a high-end GPU (e.g., 16GB or 24GB VRAM), you might encounter issues in the following scenarios:
Large Model + ControlNet: The base model (Flux.1 Dev / QwenImage) fits, but enabling ControlNet immediately causes VRAM overflow.
Multiple Stack: Using multiple ControlNets, IPAdapters, or heavy LoRAs simultaneously, causing severe memory fragmentation.
High Load: High-res upscaling, video generation (Wan2.2), or large batch sizes.
Disk Thrashing/Freeze: VRAM overflow forces the system to use virtual memory (Disk), causing the PC to freeze and generation to crawl.
💡 Core Logic: Smart Threshold
Instead of cleaning memory blindly at every step, uses Active Monitoring:
Monitor: Checks VRAM usage ratio before every model layer computation.
React:
Safe Zone (<85%): The node sleeps. Zero performance impact.
Danger Zone (>85%): The node wakes up, forcing synchronization and cleanup to prevent crashes.
💻 Hardware Requirements
VRAM: 8GB - 24GB (Effective on all).
RAM:64GB Recommended, 32GB Minimum.
Reason: When VRAM is full, data swaps to System RAM. If RAM is also full, it spills to the Disk (PageFile), causing severe lag.
🎛️ Parameters
vram_threshold:
0.85 (Default/Recommended): Triggers cleanup when VRAM usage exceeds 85%. The 15% buffer allows room for sudden spikes from ControlNet.
1.0: Disables smart monitoring (always cleans if used with interval).
cleaning_interval:
1 (Default/Recommended): Most Stable. Checks and cleans (if needed) at every layer.
⚠️ WARNING: Do NOT set this value too high (e.g., 10) on 16GB cards with large models. This will cause massive spillover to your System RAM and Disk, resulting in 100% Disk Usage and system freeze.
False (Speed): Only frees memory without stopping the GPU pipeline. Faster, but try True if you crash.
❓ Troubleshooting
Q: Why is my SSD/Disk usage at 100% and the system lagging?
A: You likely set cleaning_interval too high (e.g., > 5).
Fix: Set cleaning_interval back to 1. This ensures data flows smoothly instead of flooding your RAM and Disk.
Q: Does it work with GGUF?
A:Yes. It is highly effective for low-VRAM cards running GGUF + ControlNet.
Q: Compatibility?
A: Supports standard ComfyUI MODEL types (Flux, SDXL, SD1.5, Qwen, Pony). Does NOT support custom wrappers like WanVideoWrapper (which use non-standard types).