From 403cb471a48c401075a2cea7a2f76ca3a67ebbfa Mon Sep 17 00:00:00 2001 From: Rattus Date: Fri, 27 Mar 2026 15:54:27 +1000 Subject: [PATCH] caching: RAMPressure: Remove gc.collect() This is too expensive to run when the cache is in bankrupcy. Cache none has the same problems and if we are the last ref into cycling gargbage we need to fix it at source. The standard periodic gc is still in play. --- comfy_execution/caching.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/comfy_execution/caching.py b/comfy_execution/caching.py index a920bc866..d0a909fc5 100644 --- a/comfy_execution/caching.py +++ b/comfy_execution/caching.py @@ -528,8 +528,6 @@ class RAMPressureCache(LRUCache): if psutil.virtual_memory().available >= target: return - gc.collect() - clean_list = [] for key, cache_entry in self.cache.items(): @@ -558,4 +556,3 @@ class RAMPressureCache(LRUCache): self.used_generation.pop(key, None) self.timestamps.pop(key, None) self.children.pop(key, None) - gc.collect()