Dauphin: mona lisa genetic algorithm in clojure

111 views
Skip to first unread message

bOR_

unread,
Jan 26, 2009, 6:59:45 PM1/26/09
to Clojure
Hope this isn't a double-post, but here is a nice example of a rewrite
of some reddit post on a genetic algorithm for generating the mona
lisa in clojure by Yann N. Dauphin

http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html

Christopher

unread,
Jan 26, 2009, 8:09:30 PM1/26/09
to Clojure
This is a great post. However, the author brings up an issue with the
way that lambdas are handled by the JVM. According to the article,
lambdas are not garbage collected and can therefore overrun the
PermGen, a special place in the heap for storing anonymous classes,
and as a result, the user must increase the size of the PermGen area
to allow the program to run without running out of memory. I'd love to
hear a little more about this issue if anyone happens to know more
about it. Is this truly an issue with the current implementation of
Clojure running on the JVM or is this more of an issue with the way
the author coded up his solution? If the former is true, does anyone
know if there are any plans to correct it? If it's the latter,
however, can someone please point out the problems with the author's
implementation and give some suggestions on how we can avoid similar
mistakes.

Thanks,

Christopher
> http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa...

bOR_

unread,
Jan 27, 2009, 2:43:39 AM1/27/09
to Clojure
According to one of the posts beneath the log, the issue has been
fixed in the latests svns. I have no clue what the technical problem
was in clojure's source.

Christian Vest Hansen

unread,
Jan 27, 2009, 5:10:48 AM1/27/09
to clo...@googlegroups.com
To my understanding, the technical problem was that Clojure used the
same ClassLoader for these function classes and that ClassLoader was
kept live. Classes can only get GC'd when their ClassLoaders are GC'd.
The solution was to give each of these functions their own ephemeral
ClassLoader, so the liveness of the ClassLoader depends on the
liveness of the function. When the function is no longer live, both it
and its ClassLoader become legible for garbage collection.

>
> >
>



--
Venlig hilsen / Kind regards,
Christian Vest Hansen.
Reply all
Reply to author
Forward
0 new messages