ComfyUI > Nodes > ComfyUI-DistorchMemoryManager > Model Patch Memory Cleaner

ComfyUI Node: Model Patch Memory Cleaner

Class Name

ModelPatchMemoryCleaner

Category
Memory
Author
ussoewwin (Account age: 1026days)
Extension
ComfyUI-DistorchMemoryManager
Latest Updated
2026-03-28
Github Stars
0.03K

How to Install ComfyUI-DistorchMemoryManager

Install this extension via the ComfyUI Manager by searching for ComfyUI-DistorchMemoryManager
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-DistorchMemoryManager 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

Model Patch Memory Cleaner Description

Efficiently manages memory by unloading unused model patches to prevent OOM errors during tasks.

Model Patch Memory Cleaner:

The ModelPatchMemoryCleaner is a specialized node designed to manage memory efficiently by clearing model patches that have been loaded via the ModelPatchLoader. This functionality is particularly beneficial during resource-intensive tasks such as upscaling, where memory constraints can lead to out-of-memory (OOM) errors. By unloading unused model patches, this node helps maintain optimal memory usage, ensuring smoother performance and preventing potential disruptions in your workflow. The node operates by identifying and unloading model patches that are no longer in use, thus freeing up valuable GPU memory. This process is crucial for artists working with complex models or large datasets, as it allows for more efficient use of system resources and enhances the overall stability of the application.

Model Patch Memory Cleaner Input Parameters:

anything

This parameter accepts any input type and serves as a placeholder to ensure compatibility with various data types. It does not directly impact the node's execution but is required for the node's operation.

clear_model_patches

This boolean parameter determines whether the node should actively clear model patches loaded via the ModelPatchLoader. When set to True, it initiates the process of unloading unused model patches to free up memory. The default value is True, which is recommended for optimal memory management.

clean_gpu

This boolean parameter specifies whether the GPU memory should be cleaned as part of the memory management process. Setting this to True ensures that any residual data in the GPU memory is cleared, further optimizing memory usage. The default value is True.

force_gc

This boolean parameter controls whether garbage collection should be forced during the memory cleaning process. Enabling this option (True by default) helps in reclaiming memory that is no longer in use, thus preventing memory leaks and ensuring efficient memory utilization.

Model Patch Memory Cleaner Output Parameters:

any

The output parameter any returns the result of the memory cleaning operation. While the specific content of this output is not detailed, it generally indicates the successful execution of the memory clearing process. This output can be used to verify that the node has performed its function as expected.

Model Patch Memory Cleaner Usage Tips:

  • Ensure that clear_model_patches is set to True to maximize memory efficiency, especially when working with large models or during intensive tasks like upscaling.
  • Regularly use this node in your workflow to prevent memory-related issues and maintain optimal performance, particularly if you frequently load and unload different model patches.

Model Patch Memory Cleaner Common Errors and Solutions:

"OOM during upscaling"

  • Explanation: This error occurs when the system runs out of memory during the upscaling process, often due to loaded model patches consuming excessive resources.
  • Solution: Ensure that clear_model_patches is enabled to unload unused model patches and free up memory. Additionally, verify that clean_gpu and force_gc are set to True to optimize memory usage further.

"Model patches not unloading"

  • Explanation: This issue arises when model patches remain loaded despite the memory cleaning process, potentially due to incorrect parameter settings.
  • Solution: Double-check that all relevant parameters (clear_model_patches, clean_gpu, force_gc) are set to True. If the problem persists, review the model patch loading process to ensure compatibility with the ModelPatchMemoryCleaner.

Model Patch Memory Cleaner Related Nodes

Go back to the extension to check out more related nodes.
ComfyUI-DistorchMemoryManager
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.

Model Patch Memory Cleaner