ComfyUI > Nodes > ComfyUI-MemoryCleaner

ComfyUI Extension: ComfyUI-MemoryCleaner

Repo Name

ComfyUI-MemoryCleaner

Author
eddyhhlure1Eddy (Account age: 397 days)
Nodes
View all nodes(2)
Latest Updated
2025-11-10
Github Stars
0.03K

How to Install ComfyUI-MemoryCleaner

Install this extension via the ComfyUI Manager by searching for ComfyUI-MemoryCleaner
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-MemoryCleaner in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-MemoryCleaner Description

ComfyUI-MemoryCleaner optimizes memory usage in ComfyUI by providing nodes like Memory Cleaner (Force) to actively manage and free up memory, and Memory Status to monitor current memory usage.

ComfyUI-MemoryCleaner Introduction

ComfyUI-MemoryCleaner is a powerful extension designed to optimize memory usage for AI artists working with complex workflows in ComfyUI. This tool is particularly useful when dealing with large models or batch processing tasks that can quickly consume system resources, leading to slow performance or even crashes. By efficiently managing memory, ComfyUI-MemoryCleaner helps ensure smoother operations and enhances the overall user experience.

The extension addresses common issues such as excessive RAM usage and out-of-memory (OOM) errors by implementing a series of memory cleanup processes. These processes include unloading models from VRAM, clearing caches, and performing system-level memory trimming. As a result, AI artists can focus on their creative work without being hindered by technical limitations.

How ComfyUI-MemoryCleaner Works

ComfyUI-MemoryCleaner operates by systematically freeing up memory resources that are no longer needed during your workflow. Think of it as a diligent housekeeper that tidies up your workspace, ensuring that only the essentials are kept at hand while everything else is neatly stored away.

Here's a simplified breakdown of how it works:

  1. Model Unloading: The extension moves models from the faster but limited VRAM to the more abundant system RAM, clearing space for new operations.
  2. Python Garbage Collection: It identifies and removes unused Python objects, freeing up memory that was previously occupied.
  3. PyTorch Cache Clearing: The extension empties the CUDA cache, which is used by PyTorch for GPU operations, ensuring that no unnecessary data lingers.
  4. OS-Level Trimming: This crucial step involves reducing the working set size of processes, effectively pushing unused memory pages to disk storage, thus freeing up RAM.
  5. CUDA Synchronization: Ensures that all GPU operations are completed before final cleanup steps.
  6. Final Garbage Collection: A last sweep to catch any remaining unused memory. By following these steps, ComfyUI-MemoryCleaner can significantly reduce memory usage, allowing for more efficient processing of AI tasks.

ComfyUI-MemoryCleaner Features

ComfyUI-MemoryCleaner offers several features that can be customized to suit different needs:

  • Aggressive Trim: Enables full OS-level memory trimming, which is highly effective for freeing up large amounts of memory. This is recommended for heavy workloads.
  • Enable Privileges: Attempts to elevate system privileges to perform more thorough cleanups. If unsuccessful, the extension automatically falls back to an external helper.
  • External Helper: Utilizes an external script to perform cross-process cleanup, increasing the success rate of memory freeing operations.
  • Skip Trim if C Low: Prevents memory trimming if the C: drive has insufficient free space, protecting against potential disk space issues.
  • Minimum C Free GB: Sets a threshold for free space on the C: drive, ensuring that there is enough room for the pagefile during cleanup operations.
  • Purge Standby: Clears Windows standby memory lists, which can further free up system resources but requires administrator privileges. These features can be adjusted based on your specific workflow requirements, allowing for a tailored memory management approach.

Troubleshooting ComfyUI-MemoryCleaner

Here are some common issues you might encounter while using ComfyUI-MemoryCleaner, along with solutions:

  • C: Drive Filling Up: If you notice that your C: drive is losing space after cleanup, consider moving the pagefile to another drive or increasing the min_c_free_gb setting.
  • No Memory Freed: This could be due to active memory usage or insufficient privileges. Ensure models are unloaded before cleanup and check if the external helper is functioning.
  • External Helper Not Available: Verify that the ram_trim_target.py script is present and that your Python interpreter is correctly configured.
  • Privileges Always = NO: Running ComfyUI as an administrator can help improve privilege access, though the external helper should automatically compensate for any failures.

Learn More about ComfyUI-MemoryCleaner

To further explore the capabilities of ComfyUI-MemoryCleaner and get support, consider the following resources:

  • GitHub Repository: Visit the ComfyUI-MemoryCleaner GitHub page for the latest updates, source code, and issue tracking.
  • Community Forums: Engage with other AI artists and developers in forums dedicated to ComfyUI and memory management tools.
  • Tutorials and Documentation: Look for tutorials that provide step-by-step guidance on integrating and using ComfyUI-MemoryCleaner in your workflows. By leveraging these resources, you can maximize the benefits of ComfyUI-MemoryCleaner and enhance your creative projects with efficient memory management.

ComfyUI-MemoryCleaner Related Nodes

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

ComfyUI-MemoryCleaner detailed guide | ComfyUI