ComfyUI > Nodes > IAMCCS-nodes > VRAM Cleanup (unload + empty cache)

ComfyUI Node: VRAM Cleanup (unload + empty cache)

Class Name

IAMCCS_VRAMCleanup

Category
IAMCCS/HW
Author
IAMCCS (Account age: 2204days)
Extension
IAMCCS-nodes
Latest Updated
2026-03-27
Github Stars
0.08K

How to Install IAMCCS-nodes

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

VRAM Cleanup (unload + empty cache) Description

Optimizes VRAM usage by unloading models and clearing caches to prevent memory errors.

VRAM Cleanup (unload + empty cache):

The IAMCCS_VRAMCleanup node is designed to optimize the usage of VRAM (Video Random Access Memory) by managing and cleaning up resources that are no longer needed. This node is particularly useful in scenarios where VRAM is a limiting factor, such as in AI art generation or other GPU-intensive tasks. By efficiently unloading models and clearing caches, it helps prevent out-of-memory errors and ensures smoother operation of GPU resources. The node provides a mechanism to either unload all models or perform a soft cache cleanup, allowing for flexibility based on the user's needs. This functionality is crucial for maintaining performance and stability in environments with constrained VRAM availability.

VRAM Cleanup (unload + empty cache) Input Parameters:

unload_all_models

This parameter determines whether all models should be unloaded from VRAM. When set to True, it ensures that all models currently loaded into VRAM are removed, freeing up maximum memory space. This is particularly useful when you need to reset the VRAM state or prepare for a new task that requires significant memory. The default value is True, and it is a boolean parameter, meaning it can only be set to True or False.

soft_empty_cache

This parameter controls whether a soft cleanup of the VRAM cache should be performed. A soft cleanup attempts to free up memory by clearing cached data that is not actively in use, without unloading all models. This can help improve performance by making more VRAM available while retaining some data for quicker access if needed again. The default value is True, and like unload_all_models, it is a boolean parameter.

model

This optional parameter allows you to specify a particular model to be managed during the cleanup process. If provided, the node will consider this model in its operations, potentially retaining it in VRAM if unload_all_models is set to False. This parameter is useful when you want to selectively manage VRAM resources without affecting specific models.

clip

Similar to the model parameter, this optional parameter allows you to specify a CLIP model to be managed during the cleanup process. It provides flexibility in handling VRAM resources by allowing you to retain certain models while performing cleanup operations.

vae

This optional parameter allows you to specify a VAE (Variational Autoencoder) model to be managed during the cleanup process. It functions similarly to the model and clip parameters, offering selective control over which models are affected by the cleanup operations.

VRAM Cleanup (unload + empty cache) Output Parameters:

model

The model output parameter returns the model that was managed during the cleanup process. If a specific model was provided as an input, it will be returned here, allowing you to continue using it in subsequent operations.

clip

The clip output parameter returns the CLIP model that was managed during the cleanup process. This output is useful for maintaining continuity in workflows that involve CLIP models, ensuring that they remain available for further processing.

vae

The vae output parameter returns the VAE model that was managed during the cleanup process. This output ensures that VAE models remain accessible for subsequent tasks, providing a seamless transition between operations.

VRAM Cleanup (unload + empty cache) Usage Tips:

  • Use unload_all_models set to True when you need to completely reset the VRAM state, especially before starting a new task that requires significant memory resources.
  • Set soft_empty_cache to True to perform a gentle cleanup of VRAM, which can help improve performance without fully unloading all models, making it ideal for ongoing tasks that require some memory optimization.
  • Specify particular models using the model, clip, and vae parameters to selectively manage VRAM resources, allowing you to retain important models while freeing up unnecessary memory.

VRAM Cleanup (unload + empty cache) Common Errors and Solutions:

VRAM Out of Memory

  • Explanation: This error occurs when there is insufficient VRAM available to load or process the required models or data.
  • Solution: Use the IAMCCS_VRAMCleanup node with unload_all_models set to True to free up VRAM, and ensure that unnecessary models are not loaded simultaneously.

Model Not Found

  • Explanation: This error may occur if a specified model is not available or has been unloaded unexpectedly.
  • Solution: Verify that the model is correctly specified in the input parameters and ensure it is loaded before performing operations that require it.

Unexpected Behavior After Cleanup

  • Explanation: This can happen if essential models are unloaded during the cleanup process, affecting subsequent operations.
  • Solution: Use the optional model, clip, and vae parameters to retain specific models during cleanup, ensuring they remain available for future tasks.

VRAM Cleanup (unload + empty cache) Related Nodes

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