Alright, let me explain. I'm not talking about memory leaks or whether or not objects become eligible for collection when they should. The JVM garbage collector is a generational collector, which means there's a * humongous* difference in GC work between objects that become unreachable (eligible for GC) shortly after creation, and those that become unreachable after a while (specifically, after surviving a couple of "minor GC" cycles). While short lived objects place a tiny, almost negligible burden, on the application, long lived objects place a big burden, and the worst are those that in between, that is, not collected immediately, but not reachable throughout the lifetime of the application either (meaning, they are used for a little while, say a few seconds or so, and then discarded). The place a *huge *burden on the GC.
Now, regular, mutable collections can live for very long, but modifying them usually does not mess with the GC much. If you replace a value in a, say, ConcurrentHashMap, there are no objects created or discarded. But in Clojure, if you have a ref to a map, every assoc causes up to 6 PersistentHashMap nodes to become unreachable, and those may very well be the worst kind of medium-lived objects. OTOH, a high rate of assoc operations may constantly discard the same nodes, o they become short-lived objects and not much of a problem at all. So my question is, what is the "behavior profile" for persistent collection nodes in Clojure applications, and what is their measured effect on GC. Whatever the answer is, it's clear that their behavior from a GC perspective is very different from that of mutable collections. -- 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