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.
This commit is contained in:
Rattus 2026-03-27 15:54:27 +10:00
parent 2690e64696
commit 403cb471a4

View File

@ -528,8 +528,6 @@ class RAMPressureCache(LRUCache):
if psutil.virtual_memory().available >= target: if psutil.virtual_memory().available >= target:
return return
gc.collect()
clean_list = [] clean_list = []
for key, cache_entry in self.cache.items(): for key, cache_entry in self.cache.items():
@ -558,4 +556,3 @@ class RAMPressureCache(LRUCache):
self.used_generation.pop(key, None) self.used_generation.pop(key, None)
self.timestamps.pop(key, None) self.timestamps.pop(key, None)
self.children.pop(key, None) self.children.pop(key, None)
gc.collect()