Memoize Python Garbage Collection -
if use memoize
decorator example similar in:
https://wiki.python.org/moin/pythondecoratorlibrary#memoize
do need worry running out of memory , needing manually garbage collect? example if have long running python processess continually memoizes, won't need sure dict
not large. memoize
decorators typically need cache eviction?
why isn't issue decorators can hold arbitrary amount of intermediate state?
would using lru_cache
functools
resolve this?
the memoized
decorator linked has no bound on memory usage, , not cache eviction. yes, if keep calling function different parameters have worry running out of memory.
functools.lru_cache(n)
not store more n
calls in cache - perfect limit memory usage.
Comments
Post a Comment