General Purge VRAM V2
The zombie LayerStyle node that now also nukes SeedVR2, Qwen3-VL, Nunchaku, HSWQ and Ollama
- anything
- any
This is the flagship node of the pack, and its backstory is the reason it exists. LayerStyle's Purge VRAM V2 used to be a staple in video upscaling workflows, then it vanished from the upstream pack and everyone with a saved workflow started seeing "missing nodes" errors on load. This node keeps those legacy workflows alive under the same class name, and then kept growing. Every version added another specialty purge, and it's now the thing you reach for when a model's memory won't go away no matter what you unload.
It's a passthrough - ANY in, ANY out, exactly like the original. What differs is how much machinery runs between the two sockets.
The two toggles that do the classic thing
- purge_cache (default True) -
gc.collect(), thenempty_cache()andipc_collect()on every CUDA device. The basic "give the memory back to the driver" move. - purge_models (default True) - the aggressive unload:
cleanup_models()to drop dead models,cleanup_models_gc(), marks everything unused, callsmodel_unload(). This is the part that made the original node famous, and it still works.
The specialty toggles - why you'd pick this node at all
ComfyUI only knows about memory it manages itself. A bunch of recent tooling holds VRAM outside model_management, and stock unload can't see it. That's the gap these target:
- purge_seedvr2_models - clears SeedVR2's own
GlobalModelCache(both DiT and VAE) and releases through SeedVR2's ownrelease_model_memory(). SeedVR2 caches models independently of ComfyUI, which is exactly why upscalers built on it leak. - purge_qwen3vl_models - hunts Qwen3-VL models in
sys.modulesand live Python objects, handles thedevice_map="auto"case where a model is split across devices. - purge_nunchaku_models - FLUX/Z-Image/Qwen-Image/SDXL models running on Nunchaku's quantized engine. These hide inside wrapper classes (
NunchakuFluxTransformer2dModeland friends), and the node disables CPU offload, clears caches, and releases roughly 2.5GB of VRAM on the SDXL path. - HSWQ - a full purge for the HSWQ stack: drains its PinCache, clears PromptExecutor/SEGS caches in place, and resets the CUDA workspace so the next run still works.
- Ollama - calls Ollama's own API (
/api/generateand/api/chatwithkeep_alive=0, thenollama stop) until/api/psreports nothing loaded. This targets models loaded bycomfyui-ollamaandcomfyui-ollama-describer, including the describer's defaultkeep_model_alive=-1which would otherwise keep a model resident forever.
All five default to False. Good. Don't enable them speculatively - each one is a targeted wrecking ball for a specific stack. Enable only what your workflow actually uses, and keep purge_cache/purge_models on.
Installing it
ComfyUI Manager (search "Distorch" or "VRAM Manager"), or:
cd ComfyUI/custom_nodes
git clone https://github.com/ussoewwin/ComfyUI-DistorchMemoryManager.git
cd ComfyUI-DistorchMemoryManager
pip install -r requirements.txt
Dependencies are minimal (torch, psutil, nvidia-ml-py). Restart and the node lands under Distorch/Memory.
The honest warnings
First, legacy compatibility cuts both ways: this is a clone that has diverged a lot, and a workflow saved against the original LayerStyle node may expect slightly different behavior than what v2.4.x ships. Second, this is a big hammer. purge_models is intentionally aggressive - it can unload models the scheduler still wanted, so placing it mid-prompt (rather than between stages) can cause a re-load penalty or a hiccup. And like every node in this pack, it's a small one-maintainer project with a fast changelog, so don't auto-update without glancing at what changed. If a model you're purging refuses to die, the fix is usually the specialty toggle, not a stronger purge_models.
Inputs (8)
| Name | Type | Default | Description |
|---|---|---|---|
| anything | * | — | |
| purge_cache | BOOLEAN | true | — |
| purge_models | BOOLEAN | true | — |
| purge_seedvr2_models | BOOLEAN | false | Clear SeedVR2 DiT (base) and VAE models from cache |
| purge_qwen3vl_models | BOOLEAN | false | Clear Qwen3-VL models from GPU memory |
| purge_nunchaku_models | BOOLEAN | false | Clear Nunchaku models (FLUX/Z-Image/Qwen-Image) from GPU memory |
| HSWQ | BOOLEAN | false | Purge HSWQ residual VRAM (whole HSWQ path: models, PinCache, Detailer caches) |
| Ollama | BOOLEAN | false | Full purge of Ollama VRAM used by comfyui-ollama and comfyui-ollama-describer: unload every loaded model until /api/ps is empty (generate+chat keep_alive=0, ollama stop), clear CHAT_SESSIONS/saved_context, wipe saved_context files |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| any | * | — |