News for hackers. Stuff that matters.
Re:Clojure: Genetic Mona Lisa problem in 250 beautiful lines by tlrobinson on Monday January 26, 2009 @04:37PM (#451085)
"Lambdas are not garbage collected.

Yes. That means lambdas can be the cause of memory leaks.

As described by Charles Nutter, each lambda in Clojure is an anonymous class in Java. The problem is that classes are never garbage collected. They reside in a special place called the PermGen."

I know very little about Clojure, but that seems like a huge problem for Clojure, and other functional-ish JVM languages. Is it?

I've used Rhino (JavaScript on JVM) extensively, and I don't think it suffers from this.

Re:Clojure: Genetic Mona Lisa problem in 250 beautiful lines by jstraszheim on Monday January 26, 2009 @05:02PM (#451134)
He means the compiled code of a lambda can't be GC'ed. He was creating new functions inside of an eval.

The individual closures created as code executes are GC'ed like everything else.

Since eval is rather specialized, and everyone recommends it be avoided in "normal" code, this is not a major problem.

Plus, it is fixed.

Re:Clojure: Genetic Mona Lisa problem in 250 beautiful lines by icey on Monday January 26, 2009 @04:39PM (#451090)
"As of r1232, lambdas created in eval can be GCed."

- Comment from cgrand at the bottom of the article.

Re:Clojure: Genetic Mona Lisa problem in 250 beautiful lines by GeoJawDguJin on Monday January 26, 2009 @10:17PM (#451553)
Honestly, the JVM is pretty crappy right now for functional language support. A lot of stuff has to be implemented by hand in either the compiler or the program itself. Several features in Clojure take the latter track at the moment.

I advocate tracking down people from Sun and asking them in a personable, friendly tone of voice to please fix this kind of problem. On their front lawns.