Nodes/ComfyUI-MemoryManagement/Auto Memory Cleanup πŸ”„
ComfyUI Node

Auto Memory Cleanup πŸ”„

The lighter babysitter for your RAM

By kaaskoek232Β·Created about a year agoΒ·Updated 3 months agoΒ· 7
Auto Memory Cleanup πŸ”„
    • status_report
    • monitoring_active
    • current_memory_percent
    • last_action
    β—„enable_monitoringtrueβ–Ί
    β—„warning_threshold80β–Ί
    β—„critical_threshold90β–Ί
    β—„check_interval30β–Ί

    Smart Memory Manager in this pack is the full kitchen - cleanup, VRAM optimization, leak detection, the works. Auto Memory Cleanup is the one-dish version: it watches your RAM, and when you cross a threshold it cleans up. That's it. No leak forensics, no model unloading knobs. If your problem is specifically "my system RAM slowly turns to molasses during long sessions," this is the node to grab, because it's the cheapest thing in the pack that actually does something on its own.

    It's built around the same shared machinery as the rest of the pack - a global memory manager singleton that runs a monitoring loop in the background. You configure the thresholds and the check interval, it polls memory usage, and the moment you cross the warning or critical line, it fires a garbage collection pass.

    The inputs that matter

    • enable_monitoring (BOOLEAN, default true) - the on/off switch.
    • warning_threshold (60–95%, default 80) - cross this and it does a preventive cleanup.
    • critical_threshold (70–98%, default 90) - cross this and it does the stronger pass.
    • check_interval (5–300s, default 30) - how often it looks. Lower = more responsive, more wake-ups.

    That's the whole input list. The defaults (80/90) are honestly fine for most machines; you'd only tighten them if you're running close to the edge.

    Outputs

    status_report (STRING) and last_action (STRING) tell you what it's doing; monitoring_active (BOOLEAN) says whether the loop is actually running; current_memory_percent (FLOAT) is your current system RAM usage, and the only output you'd realistically wire into anything.

    Installing it

    No models, no heavy deps - psutil plus torch, and you already have torch. ComfyUI Manager β†’ search "Memory Management" β†’ install β†’ restart, or:

    cd ComfyUI/custom_nodes
    git clone https://github.com/kaaskoek232/ComfyUI-MemoryManagement
    pip install -r ComfyUI-MemoryManagement/requirements.txt
    

    (The README's "Quick Deployment" block has a bad clone URL pointing at a ComfyUI/ComfyUI-MemoryManagement repo that doesn't exist - use the kaaskoek232 one.)

    Common issues

    • "Memory leaks still occurring" - this node only watches RAM and runs GC; it doesn't hunt leaks. If RAM climbs despite it, the README's answer is to escalate to Smart Memory Manager with Aggressive mode and leak detection enabled, because something is growing, not just accumulating.
    • Nothing seems to happen - wire monitoring_active into a text display so you can confirm the loop started. It's a background thread, so there's no obvious visual cue otherwise.
    • Performance impact - if the wake-ups bother you, raise check_interval toward 120s. It's <0.5% CPU by the README's numbers, so usually not worth worrying about.

    Honest take: it's a small, single-purpose node, and that's fine. Use it when you want the RAM safety net and don't need the Smart manager's heavier machinery. Just remember it's a band-aid for the symptom - if your RAM keeps creeping up no matter what, the leak detector in the same pack is the next thing to pull out.

    CategoryMemory Management

    Inputs (4)

    NameTypeDefaultDescription
    enable_monitoringBOOLEANtrueβ€”
    warning_thresholdFLOAT8060–95β€”
    critical_thresholdFLOAT9070–98β€”
    check_intervalFLOAT305–300β€”

    Outputs (4)

    NameTypeDescription
    status_reportSTRINGβ€”
    monitoring_activeBOOLEANβ€”
    current_memory_percentFLOATβ€”
    last_actionSTRINGβ€”