Message395336
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. |
|
Date |
User |
Action |
Args |
2021-06-08 15:42:07 | cryvate | set | recipients:
+ cryvate, rhettinger, python-dev, serhiy.storchaka, pablogsal, nanjekyejoannah, Wouter De Borger2, kj |
2021-06-08 15:42:07 | cryvate | set | messageid: <1623166927.6.0.473983952895.issue44310@roundup.psfhosted.org> |
2021-06-08 15:42:07 | cryvate | link | issue44310 messages |
2021-06-08 15:42:07 | cryvate | create | |
|