From: Intransition Date: 2010-04-14T01:26:59+09:00 Subject: Memoize and GC I have a quick question. I just re-read: http://www.engineyard.com/blog/2010/memoization-and-id2ref/ I am wondering about garbage collection. Am I right to think that using def foo @foo ||= something end will mean that @foo be GC'd when the object is GC'd, but if I do FOO = [] def foo FOO[object_id] ||= something end Then the memorized entry will just hang around forever? If so, then how do we do it without polluting the instance var space (as in example 2), but still get the garbage collection (as in example 1)? Thanks.