Hi, I'm wondering about the space performance of Clojure's persistent data structures. For example, consider the following program, which updates a single key in a map containing other (static) data:
(loop [m {:key 0 :a 0 :b 1 :c 2 :d 3 :e 4 :f 5 :g 6 :h 7 :i 8 :j 9}] (if (< (:key m) 10000000) (recur (assoc m :key (+ 1 (:key m)))))) When run the code on JDK 1.6.0_16 (64-bit server mode) with the newest Clojure from git, the process balloons to around 400 MB! Even if I remove keys :a through :j, it uses about 100 MB less (but 300 MB is still a lot!). And even though I've thrown away the map at the end of the loop, calling (System/gc) does not reduce the memory usage significantly. That last part confuses me quite a bit -- why is Clojure not able to garbage collect my mess once I've thrown everything away? Is there something I'm missing? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---