Genetic programming generally won't appear in production code, though it might be used to generate production code. Using eval seems reasonable in the context of executing code generated by your program. I'd be interested in hearing about alternatives.
In response to this problem, Clojure now uses an ephemeral classloader. I don't know the JVM that well, but Rich Hickey says this means the anonymous classes generated by evaling fn forms can be collected.
if all the classes in the classloader are no longer referenced, and there are no references to the classloader itself, then they will all be GCed (but often there is a ref to the classloader that causes the PermGen issue).
Comments
Genetic programming generally won't appear in production code, though it might be used to generate production code. Using eval seems reasonable in the context of executing code generated by your program. I'd be interested in hearing about alternatives.
In response to this problem, Clojure now uses an ephemeral classloader. I don't know the JVM that well, but Rich Hickey says this means the anonymous classes generated by evaling fn forms can be collected.
if all the classes in the classloader are no longer referenced, and there are no references to the classloader itself, then they will all be GCed (but often there is a ref to the classloader that causes the PermGen issue).