MUForceCacheClear
A literal 'free the VRAM' button, but as a node
- model
- MODEL
ComfyUI's memory manager is smart, and that's exactly the problem. It keeps VRAM warm between runs so the next generation doesn't pay a reload cost - which is great until you're chaining heavy passes (base gen → tiled upscale → another model) and the cached junk from stage one is squeezing the headroom stage three needs. That's the situation MUForceCacheClear exists for: it runs a Python garbage-collect, forces ComfyUI to empty its soft CUDA cache, and passes your model through untouched.
The name tells you the whole story, so don't overthink it. The one input is model, the one output is MODEL, and the model comes back byte-for-byte the same. The MODEL wire is a carrier, not a payload - it exists so the node sits at the exact spot in your graph where you want the flush to happen. Put it right before the step that needs the VRAM, not after it.
Here's the mechanism detail that actually matters: the class declares NOT_IDEMPOTENT = True. Normally ComfyUI caches node outputs and skips re-running anything whose inputs didn't change. A cache-clearing node that respected that cache would never fire. By declaring itself non-idempotent, MUForceCacheClear runs on every execution no matter what - that's the author intentionally jamming the safety off. The node body itself is three lines: gc.collect(), soft_empty_cache(True), return the model.
A few honest caveats before you wire this into everything:
- It clears the soft cache, not the hard one. That's the polite flush - ComfyUI drops what it can without nuking memory it genuinely needs. That's usually what you want, but don't expect it to fix a single allocation that's just too big for your card.
- It frees cached VRAM; it won't conjure headroom out of a workload that's already at capacity. If your upscale pass alone needs 16 GB and you have 12, no node fixes that.
- Place it deliberately. Since it runs every time, in a big batch queue you're paying a small cache-flush cost on every run. That's the point, but it's also why you shouldn't scatter five of them through a workflow out of paranoia.
Installing is the easy part - it's one of six small nodes in asagi4's comfyui-utility-nodes pack, a genuinely minimal collection with just two Python dependencies (lark and jinja2) and zero model downloads. In ComfyUI Manager, search for "comfyui-utility-nodes" (or "ComfyUI utility nodes") and hit install, then restart. Prefer the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/asagi4/comfyui-utility-nodes
cd comfyui-utility-nodes
# Windows portable installs use .../python_embeded/python instead
pip install -r requirements.txt
Restart ComfyUI and the node shows up under the "utils" category as MUForceCacheClear. It's the smallest node in this pack - one input, one output, zero config. If you've ever stared at a "CUDA out of memory" while the other half of your workflow was idle in VRAM, you know exactly why it exists.
Inputs (1)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |