π§ Memory Cleanup
A big red button for RAM, VRAM, and the CUDA cache
- memory_stats
- trigger
Every once in a while your ComfyUI session just... chokes. You switch from a FLUX workflow to an SDXL one, everything should fit, and yet the GPU acts full and the machine starts swapping. ArchAi3D Memory Cleanup is the reset switch for that moment: four toggles, one run, and it dumps whatever you tell it to.
The four toggles map to four separate piles of memory:
unpin_all_vram- removes every VRAM pin. This pack's loader nodes can pin models to the GPU so ComfyUI never evicts them; this flips them all back to evictable.clear_dram_cache- empties the pack's CPU-RAM model cache. Next time any ArchAi3D loader asks for a cached model, it'll reload from disk instead.clear_vram- unloads all models from the GPU via ComfyUI'sunload_all_models().clear_cuda_cache- runs the PyTorch CUDA cache cleanup plus a garbage collect, reclaiming fragmented VRAM.
All four default to on, which is the right call for the "I just want my session back" use case. If you only want to nuke one pile - say you've got a pinned CLIP you still want cached but your RAM is dying - flip the others off.
Outputs
Two outputs, and they're both useful in a graph: memory_stats is a STRING status report after cleanup (wire it to a display node), and trigger is the execution-order pass-through - connect it to the next node so your cleanup finishes before anything heavy loads. Because the node always re-runs (it's not cached by ComfyUI's execution cache), you can drop it in a loop and it'll clear memory every pass.
Installation
It's in the ComfyUI-ArchAi3d-Qwen pack. ComfyUI Manager ("ArchAi3d Qwen") or:
cd ComfyUI/custom_nodes/
git clone https://github.com/amir84ferdos/ComfyUI-ArchAi3d-Qwen.git
cd ComfyUI-ArchAi3d-Qwen
pip install -r requirements.txt
Restart, and it appears under ArchAi3d/Memory. Personal use free, commercial use needs the author's license, like the rest of the pack.
Where people get burned
The obvious one: this only manages what ComfyUI and the ArchAi3D pack manage. If a process outside ComfyUI is eating VRAM, this won't fix it - close the browser tabs and the other GPU apps. Second, clearing the DRAM cache means the next model load is a slow disk reload; don't run it mid-batch unless the memory pressure is real. And the trigger output being a generic * type is intentional - if you wire it into a node that expects a specific type, use it as a loose connection, not as data. It's a control-flow signal, not a value.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| unpin_all_vram | BOOLEAN | true | Remove all VRAM pins. Pinned models become eligible for auto-eviction again. |
| clear_dram_cache | BOOLEAN | true | Remove all models from DRAM cache. Forces disk reload on next use. |
| clear_vram | BOOLEAN | true | Unload all models from GPU VRAM. |
| clear_cuda_cache | BOOLEAN | true | Clear PyTorch CUDA cache to reclaim fragmented VRAM. |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| memory_stats | STRING | Memory status after cleanup |
| trigger | * | Connect to next node to control execution order |