Kiko Purge VRAM:
KikoPurgeVRAM frees GPU memory during a ComfyUI workflow while letting the workflow continue with the same item it received. You can use it at a point where you want to release memory before later work, such as after a memory-intensive stage. It supports different levels of cleanup, including modes intended to unload models or clear caches, and can produce a before-and-after memory report. The node is set to run on every workflow execution rather than being skipped because of ComfyUI caching. The exact memory released depends on the cleanup implementation and what is occupying memory at the time.
Kiko Purge VRAM Input Parameters:
anything
The item you want to carry through the node. It accepts any supported connection type and is returned unchanged, whether a purge runs or is skipped. Connect the workflow item that should continue to the next step through this node. This input has no default, minimum, maximum, or set of options specified in the source.
mode
Selects the cleanup mode passed to the purge operation. The options are soft, aggressive, models_only, and cache_only; the default is soft. The interface describes these as basic cleanup, thorough cleanup, model unloading, and cache clearing, respectively. The node explicitly requests model unloading for models_only and aggressive. The detailed actions taken by each mode are defined in an imported implementation that is not included here, so the source does not establish how much memory any mode will free.
report_memory
Controls whether the node produces memory information in its text output. The default is True; the available values are True and False. When enabled and a purge runs, the node collects memory statistics before and after cleanup and formats a report that includes the selected mode and elapsed time. When enabled but the threshold prevents a purge, it returns a skip message instead. When disabled, the text output is empty in either case.
memory_threshold_mb
Sets the memory-usage threshold for deciding whether to purge, in megabytes (MB). This optional integer has a default of 0, a minimum of 0, a maximum of 48000, and a control step of 100. A value of 0 requests a purge every time the node runs. With a positive value, the node asks its threshold-checking implementation whether memory usage exceeds that value and skips cleanup if the check says it does not. This can avoid unnecessary purges, though the supplied source does not show which memory measurement the check uses.
Kiko Purge VRAM Output Parameters:
passthrough
Returns exactly the item supplied to anything. It lets you place the node in a workflow path without intentionally changing the item being passed along. The same item is returned even when the memory threshold causes cleanup to be skipped; this output is not a measurement of freed memory or a confirmation that cleanup occurred.
memory_report
Returns a text string describing the outcome when reporting is enabled. After a purge, it contains the formatted before-and-after memory report; if a positive threshold was used, the threshold message is placed before that report when one is provided. If cleanup is skipped, it begins with Memory purge skipped: followed by the threshold message. When report_memory is False, this output is an empty string. The precise wording and figures in a completed purge report depend on the imported report-formatting implementation.
Kiko Purge VRAM Usage Tips:
- Start with
softandmemory_threshold_mbset to0when you want the node to attempt cleanup each time the workflow reaches it. Enablereport_memoryto see what happened. - Place the node after a memory-intensive stage and connect
passthroughto the next stage that needs the original item. Cleanup occurs before that item is returned. - Choose
models_onlyoraggressivewhen your goal includes requesting model unloading. Choosecache_onlywhen you want the cache-focused mode. Test the resulting workflow behavior, since the supplied source does not specify the detailed effects of these modes. - Set a positive
memory_threshold_mbwhen you only want cleanup above a chosen memory-usage level. Keepreport_memoryenabled while tuning it so you can distinguish a completed purge from a threshold-based skip. - Turn
report_memoryoff when you do not need diagnostic text. The node will still check the threshold and attempt the selected purge when the check permits it.
Kiko Purge VRAM Common Errors and Solutions:
Memory purge skipped: <threshold message>
- Explanation: This is a status message, not an error. The threshold check decided not to run cleanup, and
passthroughstill returns your item unchanged. The exact text after the colon comes from the threshold-checking implementation. - Solution: If you intended to purge on every run, set
memory_threshold_mbto0. Otherwise, review your chosen threshold and keepreport_memoryenabled to see when cleanup is skipped.
memory_report is empty
- Explanation: The node deliberately returns an empty string when
report_memoryisFalse, including when a purge runs or is skipped. - Solution: Set
report_memorytoTrueif you need a report or a skip message.
The workflow runs, but little or no GPU memory appears to be freed
- Explanation: The node requests cleanup, but the provided source does not guarantee a particular amount of memory will be released. A positive threshold may also have caused the purge to be skipped.
- Solution: Enable
report_memoryand check for a skip message first. If cleanup ran, try a mode suited to what you want to release, such asmodels_onlywhen model unloading is the goal, and compare the reported before-and-after figures.
An error appears while checking memory or purging
- Explanation: The node calls imported functions to check the threshold, collect statistics, purge memory, and format the report. Their implementations and possible exception messages are not provided, so no specific error string or cause can be verified from this source.
- Solution: Check the complete ComfyUI error message to identify which operation failed. As a diagnostic step, try
memory_threshold_mbset to0andreport_memoryset toFalse, then test the available modes individually. This may help isolate a threshold or reporting failure, but it will not bypass an error in the purge operation itself.
