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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -