Nodes/ComfyUI_Dynamic-RAMCache/🧹 RAM Cache Extreme Cleanup
ComfyUI Node

🧹 RAM Cache Extreme Cleanup

The 'Clear Cache' Button ComfyUI's RAM Cache Never Gave You

By Windecay·Created 10 months ago·Updated 3 months ago· 82
🧹 RAM Cache Extreme Cleanup
  • any_input
  • output_passthrough
â—„purge_threshold256.0â–º

You know the feeling: a few generations in, system RAM is pegged, your next prompt takes twice as long, and the only fix you've found is restarting ComfyUI. Since ComfyUI started caching node outputs in RAM (RAMPressureCache / --cache-ram), the "why is my RAM maxed out" thread is a weekly event - and the usual answer is that it's not a leak, it's the cache doing exactly what it was told. The classic workaround people land on is a throwaway workflow that just clears the cache. This node is that, but targeted: one-shot, aggressive, and it puts everything back the way it was.

What it actually does

RAMCacheExtremeCleanup is a subclass of the pack's control node, so it shares the same guts. When it runs it:

  1. Reads the current RAM thresholds and cache mode (CLASSIC or RAM_PRESSURE).
  2. Force-switches to RAM_PRESSURE with purge_threshold as the headroom, triggering an aggressive eviction.
  3. Restores your previous mode and both thresholds.

The restore is automatic and silent - you don't have to reconfigure anything afterward. That's the trick that makes it safe to drop at the end of a workflow: it's a one-time purge, not a permanent change in behavior.

The one input

  • purge_threshold (GB, default 256) - minimum free RAM to maintain during the purge. The default is basically "free everything it can," since your machine rarely has 256 GB free. Lower it if you want to keep some headroom reserved, but honestly, for a cleanup node you almost never touch this.

There's also an any_input passthrough: wire something through and it comes back unchanged on the output_passthrough output; leave it empty and it emits an ExecutionBlocker, letting the node run standalone as a pure "clear the cache" action.

Where it goes

Two common placements. At the end of a workflow, so every completed run hands RAM back before the next one starts - the closest thing to a self-cleaning loop. Or as a standalone node on its own tab, wired to nothing, executed whenever you notice memory creeping up. Since it restores your previous settings, running it standalone doesn't quietly disable RAM caching - you keep the speed benefit of the cache between runs, just without the cumulative bloat.

Install and caveats

Same as its sibling node: ComfyUI Manager → search ComfyUI_Dynamic-RAMCache, or git clone https://github.com/Windecay/ComfyUI_Dynamic-RAMCache into custom_nodes, then restart. No model files, no extra dependencies - just a ComfyUI build new enough to have RAMPressureCache (upstream since 2025-10-31).

One thing worth knowing: if RAM still climbs after a purge, that's usually the next generation re-filling the cache, not the cleanup failing. This node gives you a floor, not a diet. If you want ongoing control of how much RAM the cache is allowed to hoard, that's what the pack's DynamicRAMCacheControl node (its cleanup_threshold input) is for - this one is the emergency eject.

Categoryutils/dynamic_ramcache

Inputs (2)

NameTypeDefaultDescription
purge_thresholdFLOAT256.00.1–256Minimum free RAM to maintain (GB)
any_inputopt*—

Outputs (1)

NameTypeDescription
output_passthrough*—