๐งน TA Cleanup Switch
A single node that clears VRAM and RAM โ and gets out of the way
- signal
- signal
Long multi-stage workflows have a habit of grinding to a halt on memory, not on quality. TA Cleanup Switch exists for that moment: it's a single node that flushes both VRAM and RAM, replaces the usual three-node cleanup chain, and - the clever part - passes whatever signal you route through it along unchanged.
The idea is dead simple. You've got a signal input of any type and a signal output of the same type. Anything you run through it comes out the other side intact, so you can drop it into a workflow as a pass-through just to give it a place in the graph. What actually happens during execution depends on the three booleans. enabled is the master switch - off means zero work, pure pass-through. offload_model tells ComfyUI to unload loaded models from VRAM (it uses the same free-memory mechanism as the built-in unload), and offload_cache clears the cached tensors. retry_times (default 3) is how many attempts the memory cleanup gets before it gives up - useful on systems where freeing VRAM takes a couple of passes.
This is a "place it between stages" node. Think: you finish a heavy sampling pass, want to run an upscaler or an LLM next, and you're one OOM from a cancelled queue. Put a Cleanup Switch in the path between the stages and let it flush memory before the next heavy step. The author credits ComfyUI-Memory_Cleanup as the inspiration, and the RAM side does real work too - it measures system memory before and after and prints what it freed, so you can see it doing something rather than trusting it.
Where the switch part earns its keep is control. The whole thing can be flipped off with enabled and it costs nothing - no cleanup calls, no overhead, just the pass-through. That means you can keep it in a shared workflow permanently, turn it on only when memory actually bites, and never spend time re-adding cleanup nodes to a template again.
Install. Pack-level: no Python dependencies at all, so it's the fast install:
cd ComfyUI/custom_nodes
git clone https://github.com/tmode-1960/TA-ComfyUI-Nodes-Pack
or ComfyUI Manager โ "TA ComfyUI Nodes Pack". Restart and it's under TA-Nodes.
Gotchas. First, the v2.x rewrite - TA v1 workflows won't load with v2 nodes, rebuild if you're coming from the old pack. Second, an offload is only as good as what you offload: if you're mid-batch with an active model reference, a cleanup won't unload something the graph is holding onto, so place the node between stages, not inside one. Third, the RAM cleanup takes a moment on a busy machine - that's normal, and the console output shows you the before/after percentage so you can tell it's not hung.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| enabled | BOOLEAN | true | โ |
| offload_model | BOOLEAN | true | โ |
| offload_cache | BOOLEAN | true | โ |
| retry_times | INT | 31โ10 | โ |
| signalopt | * | โ |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| signal | * | โ |