Nodes/ComfyUI-AusBoss/Free Memory πŸ†Ž
ComfyUI Node

Free Memory πŸ†Ž

A VRAM breather that passes everything through

By ausbossΒ·Created about a month agoΒ·Updated 3 days agoΒ· 2
Free Memory πŸ†Ž
  • value
  • value

Free Memory πŸ†Ž is a passthrough with a side effect. Any wire goes in, the same value comes out - but on the way, the node unloads ComfyUI's cached models and empties the CUDA cache. Drop it between two heavy stages of a workflow and the second stage starts with room to breathe instead of slamming into an out-of-memory error because the first stage's model is still parked in VRAM.

The mental model matters here, because this is not a magic OOM cure. ComfyUI already manages VRAM pretty well on its own - it caches the loaded model so that successive runs don't pay the reload cost, and it offloads when it needs to. What this node does is force the release now: unload the cached models, clear the soft cache, run garbage collection, and empty the CUDA cache, in that order. If your workflow runs a big checkpoint in stage one and then a second big model in stage two that both need the card at the same time, that explicit release between them is the difference between a run that fits and a run that dies with an OOM. It's the ComfyUI-native equivalent of swapping one model out before loading the next, and it plays nice with the reality that ComfyUI's offloading already shuffles things when it has to - you're just giving it a head start.

How it works

The input is a wildcard - the type string * - so it accepts any wire: an IMAGE, a LATENT, a MODEL, a string, whatever. That value is returned unchanged, so the node slots into a graph without rewiring anything. The memory release is best-effort by design: each step (unload models, empty comfy's cache, gc.collect(), empty the CUDA cache) is wrapped so that if ComfyUI's internals change or CUDA isn't present, that step is skipped and the wire still flows. The imports happen at runtime, not module load, so a core API change can't delete the node from your menu. You'll see a one-line [AusBoss] Free Memory: log saying what got freed.

One subtlety that's actually a feature: like any node, it only runs when its input changes. It won't break ComfyUI's caching downstream, because it doesn't force anything downstream to re-run. If you want it to fire on a particular run, its input has to be fresh.

Install

ComfyUI Manager is the easy route: search for ComfyUI-AusBoss under Custom Nodes and hit Install, then restart. Or manually:

cd ComfyUI/custom_nodes
git clone https://github.com/ausboss/ComfyUI-AusBoss.git

Restart ComfyUI and Free Memory πŸ†Ž sits under πŸ†Ž AusBoss/Utility. No extra Python dependencies. Minimum ComfyUI 0.27.1, and hard-refresh with Ctrl+Shift+R after frontend updates.

Common issues

Set expectations: freeing VRAM doesn't make a model that needs 12GB fit in 8 - the next stage still has to load, and GPU-to-RAM shuffling is brutally slower than keeping things resident (the bandwidth gap is on the order of 10x). Use this for the between-stages cleanup, not as a substitute for a quantized model or a sensible resolution. Also, because it only runs when its input changes, slapping it in and queueing the same workflow again won't re-trigger it - nudge its input if you need a manual purge. And remember it's a passthrough: the value you feed it is the value that comes out, so it's safe to insert almost anywhere.

CategoryπŸ†Ž AusBoss/Utility

Inputs (1)

NameTypeDefaultDescription
value*Any wire. Memory is freed when this node runs, then the value continues unchanged.

Outputs (1)

NameTypeDescription
value*The input, passed through unchanged.