In another thread, someone just indicated that a closed-over variable
chews up permgen. Is this true?

I had been under the impression that keywords didn't get
garbage-collected, so runtime generation with (keyword foo) ought to
be used sparingly, but that was it.

Perhaps the scenario was something along the lines of

(defn make-generator []
  (let [a (atom 0)]
    (fn [] (swap! a inc) @a)))

(def my-generator (make-generator))

user=> (my-generator)
1
user=> (my-generator)
2
user=>

In this case, a closed-over atom is referenced by a function that's
bound to a global var, my-generator. This won't be garbage-collected
so long as my-generator isn't un/redef'd. Even so it shouldn't be
permgen, technically speaking; just indirectly referenced by a loaded
class and so ineligible for GC by more "ordinary" criteria.

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

Reply via email to