@memoize works pretty similarly to
@lru_cache and doesn't do what you might expect on a method (as opposed to a simple function). It creates a global class-level cache with
self as one of the args and thus the
self object is referenced forever and cannot be garbage collected. https://bugs.python.org/issue19859 describes the situation
Log in to post a comment.