Henk-Jaap Wagenaar <[email protected]> added the comment:
Reading this bug thread last week made me realize we had made the following
error in our code:
class SomethingView():
@functools.lru_cache()
def get_object(self):
return self._object
Now, as this class was instantiated for every (particular kind of) request to a
webserver and this method called (a few times), the lru_cache just kept filling
up and up. We had been having a memory leak we couldn't track down, and this
was it.
I think this is an easy mistake to make and it was rooted, not so much in hard
references though (without that though, it would have not leaked memory) but
because of the fact the cache lives on the class and not the object.
----------
nosy: +cryvate
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44310>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com