Hi Erik, >From what I understand, to close a classloader, you would need to also remove all references to it or set the references to it to nil/null. In the case of an eval in the repl, again I'm assuming we do lose that reference once we are out of the scope of the eval.
While I said not reloading a namespace, I really meant not being able to reload a file that was on the new path added by the new classloader. So for example, if I added a swank-clojure.jar to the classpath, and I did a (require 'swank.core), then I went out of scope of the eval, did a (require 'swank.core :reload), I would get an error saying it doesn't exist. That JDI seems incredibly powerful, thanks for the tip. I was aware of add-classpath but I saw that it was deprecated, and I wanted to overcome its limitations. Unloading the classloader is an example of something not possible with add-classpath. On May 26, 4:31 am, Erik Söhnel <eriksoeh...@googlemail.com> wrote: > On 25 Mai, 08:03, Brent Millare <brent.mill...@gmail.com> wrote: > > > Erik, what you said seems to make sense. So the question now is, since > > a new classloader is started during each eval at the repl, does that > > mean that it is closed after each repl statement? This seems to be the > > case because after requiring a namespace in a previous command at the > > repl, I can no longer reload that namespace with (require > > 'foo :reload). However, because I am holding on to that namespace (as > > I can access anything in that namespace I required), I feel that it > > isn't completely unloaded. The natural follow up question would be, > > does unloading the namespace required earlier then unload the > > classloader? And, how does one test this? How does one obtain the > > hierarchy of classloaders given you don't have references to the > > children. > > Don't know for sure, I think the ClassLoader and all classes loaded > with it will be GC'ed if there are no more references to the old > classes and the loader itself. Is there even a way to "close" a > classloader? What do you mean by "can not longer reload that > namespace"? > To inspect objects of a running jvm, you can either use a debugger, or > patch the clojure.lang.DynamicClassLoader code so that it puts > reference into a static Var on each ctor call or such. > The java debug interface alsow allows you to get a list of all classes/ > objects currently available in the running vm, > seehttp://java.sun.com/javase/6/docs/jdk/api/jpda/jdi/index.html > BTW, are you aware that clojure haa aa "add-classpath" (marked as > deprecated) function, wich will be removed in future versions, due to > the problems it introduced wich java-dependencies? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en