functools.lru_cache memory leak
JeroenDelcour opened this issue · comments
tplot
makes heavy use of the functools.lru_cache
decorator which has a memory leak where class instances don't get garbage collected if it's used on methods (see also this video).
Since we only cache one value in all cases (lru_cache(maxsize=1)
), it might as well be a cached_property instead. There's a backport available for Python <3.8.
Thanks to @dmatos2012 for telling me about this!