New submission from Wouter De Borger <wou...@inmanta.com>:
# Problem the functools.lru_cache decorator locks all arguments to the function in memory (inclusing self), causing hard to find memory leaks. # Expected I had assumed that the lru_cache would keep weak-references and that when an object is garbage colected, all its cache entries expire as unreachable. This is not the case. # Solutions 1. I think it is worth at least mentioning this behavior in de documentation. 2. I also think it would be good if the LRU cache actually uses weak references. I will try to make a PR for this. ---------- components: Library (Lib) messages: 395075 nosy: Wouter De Borger2 priority: normal severity: normal status: open title: lru_cache memory leak versions: Python 3.10, Python 3.11, Python 3.6, Python 3.7, Python 3.8, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44310> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com