3 ms·
Does this technique keep the memoization table in memory while the top level function is in scope (so essentially forever?) Or does it become unreachable once t
by simiones 3y ago
Does this technique keep the memoization table in memory while the top level function is in scope (so essentially forever?) Or does it become unreachable once the initial call to fib from somewhere else finish?
- deleted 3y ago[deleted]
- byorgey 3y agoIt keeps the table in memory while the function is in scope.
- tsimionescu 3y agoI assume this could be fixed by using a lambda instead of a top level function if you only want to occasionally call such a function, and don't need the whole memoization table around all the time?
- consilient 3y agoYes, although you need to make sure it doesn't get optimized away.