VRAM Unload π€
When you need the GPU to drop everything
- unload_report
- memory_freed
- success
VRAM Optimizer in this pack cleans up. VRAM Unload is the heavier hammer - it's the one you reach for when you want the GPU to drop what it's holding now, before a step you know is going to eat every last megabyte. Same family, same philosophy, but where the optimizer tidies, this one evicts.
The pack is ComfyUI-MemoryManagement by kaaskoek232, seven nodes all about not letting a long session drown in accumulated memory. VRAM Unload's job: flush the GPU's VRAM with as much or as little force as you want, then tell you how much you got back.
How it works
Pick a strategy and it runs a cleanup pass:
- Smart (default) - clears PyTorch's CUDA cache and does a single garbage collection pass. Usually all you need.
- Aggressive - three rounds of
gc.collect()plus cache clearing. For when Smart didn't feel like enough. - Complete - five GC passes, three rounds of cache clearing, and it resets PyTorch's peak and accumulated memory stats. The "scorched earth" option.
Every strategy also syncs the GPU afterwards, so the freed numbers you read back are real.
The inputs that matter
- trigger (INT) - bump this to fire the unload.
- unload_strategy - Smart / Aggressive / Complete, default Smart.
- target_device (INT, optional, default -1) - -1 targets all GPUs; a number 0β7 targets one. Multi-GPU only.
- force_unload (BOOLEAN, optional, default false) - the flag that makes the unload more aggressive. The docs frame it as "force aggressive unloading"; with the strategy options already covering that spectrum, it mostly exists so you can flip it without touching the dropdown.
Outputs
unload_report (STRING) is the human-readable rundown, memory_freed (INT, bytes) is the number you'll actually look at, and success (BOOLEAN) tells you it ran. All three are output-node style - mostly display, success if you want to gate something on the result.
Installing it
Same as every node in this pack - no models, psutil is the only dependency beyond torch. ComfyUI Manager β search "Memory Management" β install β restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/kaaskoek232/ComfyUI-MemoryManagement
pip install -r ComfyUI-MemoryManagement/requirements.txt
The README's "Quick Deployment" clone URL is wrong (it points at a nonexistent ComfyUI/ComfyUI-MemoryManagement); the kaaskoek232 URL above is the real one.
Common issues & honest advice
- Everything you unload gets reloaded. That's the thing to internalize with this node: next generation, ComfyUI loads the models back into VRAM anyway. So firing this mid-pipeline mostly hurts you. Use it between runs, or right before a single step you know is VRAM-hungry.
- "Complete" resets your peak-memory stats. If you're benchmarking or watching peak usage to decide on a new card, know that Complete wipes that history. Use Smart or Aggressive if you want the numbers to stay honest.
- "CUDA not available" - without a CUDA-enabled torch build the node can't do anything; same fix as the rest of the pack (install CUDA PyTorch).
Real talk: Smart is enough for almost everyone, and the three levels are mostly a knob for how paranoid you feel. Where this node earns its keep is the discipline it forces - a clean GPU between batch jobs is why you won't be reaching for the restart button on day three of a long generation session.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| trigger | INT | 00β1000000 | β |
| unload_strategy | COMBO | Smart | 3 options: Smart, Aggressive, Complete |
| target_deviceopt | INT | -1-1β7 | β |
| force_unloadopt | BOOLEAN | false | β |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| unload_report | STRING | β |
| memory_freed | INT | β |
| success | BOOLEAN | β |