Nodes/Emu35-Comfyui-Nodes/Emu 3.5 VRAM Cleanup
ComfyUI Node

Emu 3.5 VRAM Cleanup

The kitchen-sink memory janitor, with receipts

By EricRollei·Created 9 months ago·Updated 9 months ago· 5
Emu 3.5 VRAM Cleanup
  • any_input
  • model
  • vq_model
  • passthrough
  • status_report
  • memory_diff
cleanup_level
triggertrue
unload_modelsfalse

If Emu 3.5 Clear Cache is the "free my VRAM" button, Emu 3.5 VRAM Cleanup is the version that shows its work. It's the pack's most comprehensive memory node: four cleanup depths, before/after telemetry on both RAM and every GPU, a pass-through so you can wire it anywhere, and a status report you can actually read instead of guessing whether it did anything.

The mechanism is exactly what you'd hope: it snapshots your RAM usage plus per-GPU allocated/reserved/free memory (via psutil and torch), runs the cleanup level you picked, then snapshots again and hands you both reports plus a diff. The levels go:

  • light (cache only) - just torch.cuda.empty_cache(). Fast, low-stakes.
  • standard (cache + gc) - adds a garbage-collection pass and IPC buffer flush.
  • aggressive (deep clean) - three GC rounds, CUDA synchronization across all devices, cache flush, and peak-memory-stat resets. For when something leaked and the normal pass isn't cutting it.
  • nuclear (unload all models) - moves the wired model and VQ model to CPU and then runs the aggressive pass on top.

The inputs that matter

  • cleanup_level - the four-option dropdown above.
  • trigger - BOOLEAN, defaults to true. Set it to false and the node returns "Cleanup skipped" - a handy way to toggle cleanup without rewiring.
  • any_input - optional * pass-through, so you can chain the node into a wire and get whatever came through back out of passthrough.
  • model / vq_model - optional; needed only if you want nuclear or unload_models to actually move them.
  • unload_models - BOOLEAN, defaults false. Force-unloads the models even at non-nuclear levels.

Outputs

  • passthrough (*) - whatever you fed in via any_input.
  • status_report (STRING) - the full before/after memory report, RAM and all GPUs.
  • memory_diff (STRING) - the "here's what you freed" summary, with signed GB numbers.

Install

Same pack, same ritual:

cd ComfyUI/custom_nodes
git clone --recursive https://github.com/EricRollei/Emu35-Comfyui-Nodes.git emu35
cd emu35
pip install -r requirements.txt

Where you actually want it

Two placements. Before an Emu node, to start with a clean slate - which matters on 24GB cards where a crashed previous run leaves the allocator holding memory it shouldn't. And after an OOM error, as the first thing you run to claw back VRAM so you can relaunch without restarting ComfyUI. The memory_diff output is genuinely useful there: it tells you in GB whether the cleanup recovered what you thought it would, or whether the model is still sitting on the card and you need nuclear.

The honest caveat is the same one that applies to all memory nodes in this pack: cleanup recovers allocator state, it doesn't conjure headroom that a resident 34B model is legitimately using. If you're consistently OOMing mid-inference on a 24GB card, the actual fix is NF4 weights, the VQ model on CPU, and ComfyUI's --lowvram / --reserved-vram flags - this node just makes the crash-landing softer.

CategoryEmu3.5

Inputs (6)

NameTypeDefaultDescription
cleanup_levelCOMBO4 options: light (cache only), standard (cache + gc), aggressive (deep clean), nuclear (unload all models)
triggerBOOLEANtrue
any_inputopt*
modeloptEMU_MODEL
vq_modeloptEMU_VQ
unload_modelsoptBOOLEANfalse

Outputs (3)

NameTypeDescription
passthrough*
status_reportSTRING
memory_diffSTRING