Pin CLIP Residency
Keep your text encoder from getting evicted mid-workflow
- clip
- CLIP
Pin CLIP Residency is the text-encoder version of the pack's pin nodes: it marks a tracked CLIP object as sticky so ComfyUI's patched free_memory() protects it when VRAM pressure hits, and it lets you set a priority so you control which pinned things survive a squeeze. Pass a CLIP in, mark it, get the same CLIP out.
Why pin a CLIP specifically? Text encoders are a weird middle case. They're not as huge as a modern UNet, but on Flux and the T5-class encoders they're not small either - and they get reloaded constantly if you keep swapping between checkpoints that each bundle their own. The classic failure is: you encode your prompt, then the workflow loads a big model, VRAM runs short, and the CLIP gets evicted. Next run re-encodes, re-loads the text encoder, and you've added seconds of churn to a job that could have just reused what was already there. Pinning the CLIP makes the encoder the last thing evicted instead of the first.
The inputs:
clip- theCLIPto mark. It needs to be a tracked native entry - loaded through this pack's resident loaders or a stock ComfyUI checkpoint/CLIP load.sticky-truepins it,falseunpins. Defaulttrue.priority--100to100, default0. Higher is protected first.
Output is the same CLIP passed through unchanged, so wire it in line between your loader and your CLIP Text Encode node.
Mechanically this is identical to the other pin nodes: it calls the residency registry's set_sticky on the CLIP's patcher, and the protection only actually kicks in under the sticky_gpu policy, where free_memory() considers sticky entries first, protects higher-priority ones, and applies a floor so small requests don't tear down residents. Worth knowing: under sticky_gpu, newly loaded CLIPs are auto-pinned anyway, so this node is really for tuning priority or for un-pinning one you don't want held.
Two caveats to internalize. Pins die with the process - close ComfyUI and the residency is gone, no cross-process persistence. And a pin only works on objects the registry actually tracks; a CLIP loaded through some third-party node's private path may never become a tracked entry. If your workflow runs a prompt through the same text encoder repeatedly on a big card, pinning it is a genuinely good idea; if you're on a small card where every MB counts, remember a sticky CLIP is memory you're deliberately reserving, so pin with intent.
Install with the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/xmarre/ComfyUI-GPU-Resident-Loader
cd ComfyUI-GPU-Resident-Loader
pip install -r requirements.txt
Restart ComfyUI, or search "comfyui-gpu-resident-loader" in ComfyUI Manager.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| clip | CLIP | — | |
| sticky | BOOLEAN | true | — |
| priority | INT | 0-100–100 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| CLIP | CLIP | — |