Python functools lru_cache with instance methods: release object
Python functools lru_cache with instance methods: release object Question: How can I use functools.lru_cache inside classes without leaking memory? In the following minimal example the foo instance won’t be released although going out of scope and having no referrer (other than the lru_cache). from functools import lru_cache class BigClass: pass class Foo: def __init__(self): self.big …