top | item 41468773

(no title)

whiteros_e | 1 year ago

Dynamic classes cannot be GC'd without the classloader being dereferenced. In this case, if eval used an existing classloader we would end up exhausting metaspace and leading to MaxPermGen exception.

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...

discuss

order

ayewo|1 year ago

Thanks for linking directly to the specific line number in the Compiler.java [1] code referenced in the original article.

Not sure why they have that if statement that always evaluates to true:

   if(true)//!LOADER.isBound())
I usually prefer using the GitHub permalink [1] as it is easy for the line number to go out of sync.

[1] https://github.com/clojure/clojure/blob/f376cf62bb0c30f72b0d...

layer8|1 year ago

Side note: You’re using the term “dereference” incorrectly (also in the article). It doesn’t mean “drop references”. It means “going from the reference to the thing being referenced”, or (in other words) “accessing the thing that is being referenced” [0]. It doesn’t mean the reference is going away.

[0] https://en.wiktionary.org/wiki/dereference#Verb