LayerUtility: Purge VRAM V2
PurgeVRAM V2 — free VRAM mid-workflow so the next stage doesn't OOM
- anything
- any
You built a workflow that loads a checkpoint, does its thing, then tries to load a second big model - an upscaler, a video model, a face-swap - and ComfyUI falls over with a CUDA out-of-memory error even though the first model is done with. That's the problem this node exists for. PurgeVRAM V2 unloads models and clears the cache on demand, right in the middle of the graph, so the heavy thing downstream gets room to breathe.
It comes out of chflame163's ComfyUI Layer Style pack - the big Photoshop-style compositing suite - but this particular node has nothing to do with layers. It's a plumbing utility, and a genuinely useful one. People wire it into VRAM-hungry pipelines specifically to buy headroom; in one well-known LTX-Video thread someone dropped a purge node in and cut their VRAM use almost in half.
How it works
ComfyUI keeps models resident in VRAM between runs so it doesn't have to reload them. Great for speed, bad when you're stacking two models that don't fit together. PurgeVRAM V2 forces the unload: it evicts loaded models from the GPU and flushes the torch allocator cache, the same cleanup ComfyUI does at reload but triggered exactly where you want it.
The "V2" difference is the one that matters: it has a pass-through output, so you can splice it inline rather than hang it off to the side. Whatever you feed its anything input comes straight back out the any output unchanged. That passthrough is doing real work - it's how you control when the purge fires. Wire the tensor from stage one into the node and the output onward into stage two, and ComfyUI's dependency ordering guarantees the purge happens after the first stage finishes and before the second loads.
The inputs and outputs that matter
anything(accepts any type) - the thing you route through to force execution order. An image, a latent, a model, doesn't matter; it's just the baton.purge_cache(default on) - clears the torch/Python cache.purge_models(default on) - unloads resident models from VRAM. This is the big one.
Output is any, the same value you passed in. Send it into the next node in the chain. Leave both toggles on unless you have a reason not to.
How to install it
Two easy ways. In ComfyUI Manager, open the Custom Nodes Manager, search ComfyUI Layer Style, install, and restart. Or from a terminal:
cd ComfyUI/custom_nodes
git clone https://github.com/chflame163/ComfyUI_LayerStyle
then install its requirements into ComfyUI's Python (pip install -r requirements.txt) and restart. It's a large pack with a long dependency list, so give the first launch a minute. You'll find the node under the 😺dzNodes → LayerUtility → SystemIO menu.
Common issues and the honest take
The one thing that trips people up: the purge only fires when the node actually runs, and that's governed by graph dependencies, not by where it sits visually. If you drop it off in the corner with nothing depending on its output, ComfyUI may prune it or run it at the wrong time. Route the passthrough through the node so it sits between the two stages, and the ordering takes care of itself.
The honest caveat is about weight. If PurgeVRAM is the only thing you want from this pack, you're installing a very large compositing suite for one small utility - which is exactly why some people skip it and grab a single-purpose "free memory" node instead (that LTX thread ended with someone doing precisely that). If you already run Layer Style for its mask and compositing nodes, though, this is free and it's right there. And if you don't need the passthrough, the original PurgeVRAM (no V2) does the same purge as a plain terminal node.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| anything | * | — | |
| purge_cache | BOOLEAN | true | — |
| purge_models | BOOLEAN | true | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| any | * | — |