Of course the next step is to write an implementation of memoize that stores the entries in its maps using SoftReferences (
http://java.sun.com/javase/6/docs/api/java/lang/ref/SoftRefe...). This way, anything stored in the cache will always be garbage collected before the JVM throws an OutOfMemoryError. I'm surprised that SoftReferences are not part of the default implementation given Clojure's nice Java interop as they would be perfect for a function like memoize.