VRAM Cleanup (unload + empty cache)
The little passthrough that buys you headroom at the exact moment you need it
- model
- clip
- vae
- model
- clip
- vae
IAMCCS_VRAMCleanup is about as simple as a ComfyUI node gets: it runs garbage collection, optionally unloads all models, empties the CUDA cache, and passes your model/clip/vae through untouched. It's a deliberate, placed "reset memory now" in the middle of a graph - usually between two heavy stages where you know the first one left the GPU bloated and the second one is about to OOM.
The reason a node like this exists at all is that PyTorch doesn't give VRAM back to the driver when tensors go out of scope. It keeps freed blocks in its own caching pool, and torch.cuda.empty_cache() releases the unused reserved blocks back. Sometimes that alone is enough to squeeze one more pass onto a 12 GB card. ComfyUI's own soft_empty_cache does this internally, but it runs on its own schedule - this node lets you force it at a graph position you control.
How it works
Two toggles, and they do very different things:
unload_all_models(default true): calls ComfyUI'sunload_all_models(), which evicts loaded checkpoints/models back to CPU or disk. Maximum headroom, but the next time anything needs that model, ComfyUI has to reload it - on a big video model that's a real stall you'll feel.soft_empty_cache(default true): the cheap one -soft_empty_cache()plustorch.cuda.empty_cache(). Releases reserved-but-unused blocks without unloading anything.
The optional model, clip, vae inputs are pass-through slots, not things it consumes. Wire them in only if you want them to flow out the other side into the next stage; the node doesn't care either way.
Where it actually helps
The pattern that makes this node worth keeping around: sampler-heavy video workflows where you decode, do a second pass, or chain multiple KSamplers. Drop IAMCCS_VRAMCleanup after a VAE decode and before the next sampling block. Same pack, different flavor: IAMCCS_VRAMFlushLatent is the passthrough-LATENT version designed to sit between two sampler passes after a VideoVAE leaves the pool bloated, and IAMCCS_VAEDecodeTiledSafe's cleanup_before_decode flag flushes the cache without unloading - the authors clearly learned the hard way that unloading mid-pipeline stalls harder than the OOM it prevents.
That last point is your real gotcha. Start with unload_all_models off and only flip it on when a cache flush genuinely isn't enough. If you're seeing "out of memory" three frames from the end and the reload-stall isn't a problem, then yes, unload. Otherwise the empty-cache-only mode is the one you want 90% of the time.
Installing it
This is one node in the IAMCCS-nodes pack (one repo, all IAMCCS nodes). ComfyUI Manager → search IAMCCS, or:
cd ComfyUI/custom_nodes
git clone https://github.com/IAMCCS/IAMCCS-nodes.git
Restart ComfyUI; it's under IAMCCS/HW. No requirements.txt to worry about, no model downloads. README floor: ComfyUI ≥ 0.3.0, Python ≥ 3.12, Torch ≥ 2.8.
Where people get burned
- Expecting it to free VRAM on its own before a stage runs. ComfyUI executes nodes in dependency order - this node only cleans at the moment it executes, so place it so it runs after the stage that bloats memory and before the stage that needs it.
- Leaving
unload_all_modelson in a graph that reloads the model every iteration, which turns each pass into a 10-30 second reload cycle. That "why is my workflow suddenly 3x slower" moment is usually this. - Treating it as a magic fix for a workflow that's simply too big. Emptying the cache recovers unused blocks; it won't conjure VRAM that's genuinely in use.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| unload_all_models | BOOLEAN | true | — |
| soft_empty_cache | BOOLEAN | true | — |
| modelopt | MODEL | — | |
| clipopt | CLIP | — | |
| vaeopt | VAE | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |
| clip | CLIP | — |
| vae | VAE | — |