Release Memory
A scheduled cleanup button for VRAM hoarders
- passthrough
- then
The longer a ComfyUI session runs, the more the GPU quietly accumulates: cached model runtimes, tagger weights, SAM processors, torch's own allocator hoarding freed memory. On a 6GB card, "why did my next run OOM when the previous one fit?" is usually this. Release Memory is the pack's answer - a node that unloads the runtimes you opt into and asks Python/torch to give the allocator's memory back, at a point in the workflow you choose.
The clever bit is how it schedules itself. ComfyUI's graph isn't really sequential - nodes fire when their inputs are ready - so a "clean up at the end" node needs something to sequence on. Release Memory solves that with a pass-through socket: connect the after input to whatever runs last, and the cleanup fires when that upstream step finishes, then forwards the value unchanged on then.
How it works
At execution, the node checks whether after is actually connected. If it isn't, it skips everything and logs skipped reason=after_not_connected - a deliberate design so an orphaned node never nukes memory mid-graph by accident. If it is connected, it runs the cleanup steps you've enabled:
generation_runtime(default on) - unloads generation models where possible, plus this pack'sUse Loaded Modelcache and its VAE runtime.sam3_runtime(default on) - clears theSAM3 Prompt To Maskprocessor cache.tagger_runtime(default on) - clears the PixAI Tagger and OppaiOracle Tagger model caches.gc_cuda_cleanup(default on) - runs Python garbage collection, then asks ComfyUI and torch to clear available CUDA allocator memory.
The then output passes the value through untouched, so the node can sit inline near the end of a workflow without disturbing the data flow.
There's also a Release Now button on the node that runs the same cleanup manually when no prompt is executing - genuinely handy for that moment you want to free VRAM before a big batch without re-running anything.
Why you'd reach for it
If you batch-generate, you've hit the wall where run N+1 OOMs because run N left a trail of cached runtimes. Dropping Release Memory after your save step (feed it the saver's output through after) makes each run start clean. It also pairs with the pack's own memory-hungry pieces - after a tagging pass, clearing the tagger runtime keeps the tagger's weights from squatting in VRAM during sampling.
The honest limits
"Release" is best-effort, not a guarantee. The node unloads what it can and asks torch's CUDA allocator to return free blocks - but allocator-held memory is only returned when possible, and ComfyUI's own model management may decide to reload things later. On Windows especially, don't expect task-manager numbers to drop to zero. What you can reliably expect: the next heavy node has substantially more room.
Also remember the sequencing rule: without a connection on after, this node does nothing. It's not a "clear everything" button you can drop anywhere; it fires at a specific point in the graph by design.
Installing
Part of kinorax/comfyui-info-prompt-toolkit:
cd ComfyUI/custom_nodes
git clone https://github.com/kinorax/comfyui-info-prompt-toolkit.git
cd comfyui-info-prompt-toolkit
pip install -r requirements.txt
or install "Info-Prompt-Toolkit" via ComfyUI Manager, then restart. No model files. It's listed under Info-Prompt-Toolkit/Utility and shows up in the node search if you type "free memory" or "release vram" - the author added search aliases precisely so people can find it.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| generation_runtime | BOOLEAN | true | Release generation runtime references, including sampler model, CLIP, and VAE runtimes |
| sam3_runtime | BOOLEAN | true | Release the SAM3 Prompt To Mask runtime cache |
| tagger_runtime | BOOLEAN | true | Release the PixAI Tagger and OppaiOracle Tagger runtime caches |
| gc_cuda_cleanup | BOOLEAN | true | Run Python garbage collection, then ask ComfyUI and torch to clear available CUDA cache memory |
| passthroughopt | COMFY_MATCHTYPE_V3 | Connect this input to run workflow memory release; the value is returned unchanged |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| then | COMFY_MATCHTYPE_V3 | — |