I have some code that blows up the heap and I'm not sure why. I've reduced it down to the following.
I've tried to make sure the atom doesn't have boundless growth and I didn't think 'while' hangs on to the head of sequences so I'm embarrassed to say I'm stumped. (defn leaks-memory [] (let [mem (atom []) chunksize 1000 threshold 2000] (while true (swap! mem conj (rand-int 100)) ; every 'chunksize' item past 'threshold' (when (and (= 0 (mod (count @mem) chunksize)) (> (count @mem) threshold)) (swap! mem subvec chunksize))))) -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.