ComfyUI > Nodes > RES4LYF > SamplerOptions_GarbageCollection

ComfyUI Node: SamplerOptions_GarbageCollection

Class Name

SamplerOptions_GarbageCollection

Category
RES4LYF/sampler_extensions
Author
ClownsharkBatwing (Account age: 287days)
Extension
RES4LYF
Latest Updated
2025-03-08
Github Stars
0.09K

How to Install RES4LYF

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

SamplerOptions_GarbageCollection Description

Enhances sampler performance by enabling garbage collection after each step, managing memory effectively.

SamplerOptions_GarbageCollection:

The SamplerOptions_GarbageCollection node is designed to enhance the performance of samplers, particularly when working with large models that may encounter out-of-memory (OOM) issues during inference. This node achieves its purpose by enabling garbage collection after each sampling step, which helps manage memory usage more effectively. While this approach can mitigate memory-related problems, it comes with the tradeoff of potentially slower sampling times. This node is particularly useful for users working with complex models like Flux, where memory management is crucial for successful inference. By integrating garbage collection into the sampling process, this node provides a practical solution for maintaining system stability and preventing crashes due to memory overload.

SamplerOptions_GarbageCollection Input Parameters:

sampler

The sampler parameter is a required input that specifies the sampler to be used in the process. This parameter is crucial as it determines the sampling method and influences the overall behavior and output of the node. The sampler is expected to be of type SAMPLER, and it serves as the foundation upon which additional options, such as garbage collection, are applied. There are no specific minimum or maximum values for this parameter, as it is a categorical input representing different sampler types.

garbage_collection

The garbage_collection parameter is a required boolean input that controls whether garbage collection is enabled during the sampling process. By default, this parameter is set to True, meaning that garbage collection will be performed after each sampling step. Enabling this option helps manage memory usage and can prevent out-of-memory errors, especially when working with large models. However, it may also result in slower sampling times due to the additional overhead of garbage collection. Users can choose to disable this feature by setting the parameter to False if they prioritize speed over memory management.

SamplerOptions_GarbageCollection Output Parameters:

sampler

The sampler output parameter returns the modified sampler with the specified extra options applied, including the garbage collection setting. This output is of type SAMPLER and reflects the changes made to the original sampler input, ensuring that the garbage collection option is integrated into the sampling process. The returned sampler is ready for use in subsequent steps, with the memory management enhancements provided by the garbage collection feature.

SamplerOptions_GarbageCollection Usage Tips:

  • Consider enabling garbage collection when working with large models to prevent out-of-memory errors, especially if you encounter stability issues during inference.
  • If speed is a priority and memory is not a constraint, you can disable garbage collection to potentially improve sampling times.

SamplerOptions_GarbageCollection Common Errors and Solutions:

MemoryError

  • Explanation: This error occurs when the system runs out of memory during the sampling process, which can happen if garbage collection is disabled or insufficient for the model size.
  • Solution: Enable garbage collection by setting the garbage_collection parameter to True to help manage memory usage more effectively.

SlowPerformanceWarning

  • Explanation: This warning indicates that the sampling process is slower than expected, likely due to the overhead introduced by garbage collection.
  • Solution: If memory usage is not a concern, consider disabling garbage collection by setting the garbage_collection parameter to False to improve performance.

SamplerOptions_GarbageCollection Related Nodes

Go back to the extension to check out more related nodes.
RES4LYF
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 Playground, enabling artists to harness the latest AI tools to create incredible art.