|
|
|
|
|
by ayewo
656 days ago
|
|
Interesting article. 1. I’m having a bit of trouble parsing this paragraph: > The reason eval loads a new classloader every time is justified as dynamically generated classes cannot be garbage collected as long as the classloader is referencing to them. In this case, single classloader evaluating all the forms and generating new classes can lead to the generated class not being garbage collected. To avoid this, a new classloader is being created every time, this way once the evaluation is done. The classloader will no longer be reachable and all it’s dynamically loaded class. It sounds like the solution they adopted was to instantiate a brand new classloader each time a dynamic class is evaluated, rather than use a singleton classloader for the app’s lifetime. |
|
Initial Clojure implementation was checking for an already created classloader and tried to reuse. They had commented out the code that was doing it.
Link to the code in the compiler: https://github.com/clojure/clojure/blob/clojure-1.11.0/src/j...