Nodes/comfyui-memory-manager/⚙️ Set Cache Size
ComfyUI Node

⚙️ Set Cache Size

The tuning knob for a cache that isn't wired up yet

By darshd9941·Created 4 months ago·Updated 4 months ago· 1
⚙️ Set Cache Size
    • status
    max_gb6.0

    Set Cache Size is the knob on the front of the pack's LRU model cache. You give it a number of gigabytes, it sets the cache's max budget, and it returns Cache size set to 6GB. That's the whole interface. It's also, as of the current release, a knob connected to a machine that isn't plugged in - and it's worth knowing that before you go reaching for it.

    The idea, as advertised

    The README promises an LRU cache that "automatically evicts least-recently-used models when VRAM fills up." Set Cache Size is how you'd tune that: keep the budget small so models get evicted early on a cramped card, raise it on a 24GB card where you'd rather keep checkpoints hot. 📈 Cache Stats is the display for the same budget, and the two are clearly meant to be a pair.

    The reality, straight from the source

    I read the code so you don't have to, and here's the thing: the LRU cache class exists and is implemented properly - an OrderedDict, a byte budget, move_to_end for recency, an eviction loop that pops the least-recently-used entry and calls gc.collect() + torch.cuda.empty_cache() after each eviction. Textbook.

    But in the entire pack, no node ever puts a model into that cache. Nothing calls cache.put(), nothing hooks ComfyUI's model loader, and the comfy.model_management module is imported but never touched. There's an estimate_model_size() helper for sizing models into the cache that nothing calls - pure dead code. So set_cache_size(max_gb) changes max_size_bytes on an object that stays permanently empty. Set Cache Size is, today, a no-op that returns a pleasant status string.

    That's not a dig at the author so much as a status report: this looks like a feature that was built ahead of its wiring, a v0.1 of the cache half of the pack. If a future release actually connects the cache to ComfyUI's model loading, this node becomes the real tuning knob. Right now it isn't.

    Input and output

    • max_gb (FLOAT, default 6.0, range 1.0–24.0, step 0.5): the only input. Set it to your card's practical model budget - around half of an 8GB card's VRAM is a reasonable starting point if the cache ever starts working.
    • Output: status (STRING) - just Cache size set to XGB, nothing to wire onward. No trigger input, so it sets the value each time the queue runs.

    Installation

    Same pack, same install as its four siblings:

    cd ComfyUI/custom_nodes
    git clone https://github.com/darshd9941/comfyui-memory-manager.git
    cd comfyui-memory-manager
    pip install -r requirements.txt   # torch>=2.0, already present
    

    Or ComfyUI Manager → search comfyui-memory-manager → Install → restart. No model downloads, no heavy deps.

    What to do instead, if you came here to control memory

    Since this node doesn't actually move the needle yet, here's what does:

    • ComfyUI's own management already offloads and swaps models as needed - leave it alone unless you have a real reason not to.
    • Edit → Unload Models and Execution Cache is the manual reset when you need everything off the card.
    • GGUF quantized checkpoints are the real lever for fitting big models on small cards - the actual way to stop OOM is a smaller model, not a bigger cache.

    If Set Cache Size silently does nothing for you after this, that's the correct behavior for the current code. Check the pack's releases periodically - this is a young project (single author, single commit at the time of writing), and the cache wiring is the most likely thing to land next.

    Categorymemory/management

    Inputs (1)

    NameTypeDefaultDescription
    max_gbFLOAT6.01–24

    Outputs (1)

    NameTypeDescription
    statusSTRING