Clojure closures and GC

Posted by Ralph on Stack Overflow See other posts from Stack Overflow or by Ralph
Published on 2011-01-03T23:47:26Z Indexed on 2011/01/03 23:53 UTC
Read the original article Hit count: 236

It is my understanding that the default ClassLoader used in Java (and thus, Clojure) holds on to pointers to any anonymous classes created, and thus, onto lambdas and closures. These are never garbage collected, and so represent a "memory leak". There is some investigation going on for Java 7 or 8 to adding an anonymous ClassLoader that will not retain references to these functions. In the mean time how are people dealing with writing long-running applications in languages like Clojure and Scala, that encourage the use of these constructs?

Is there any possibility that Clojure could provide its own anonymous ClassLoader, extending the system one, but not holding onto created classes?

© Stack Overflow or respective owner

Related posts about garbage-collection

Related posts about clojure