On Oct 4, 4:01 am, Christophe Grand <christo...@cgrand.net> wrote:
> Are you sure you aren't leaking memory? (by keeping a reference to an ever
> growing state -- do you use memoize?)

You're right, it was a memory leak, although it took me hours to find.
Clojure's lazy lists were responsible for the leak; I wasn't honestly
expecting this innocent looking code to be so insidious....

(defn leak []
  (loop [v [0 0]]
    (recur (map + v [1 1]))))

Adding a doall call fixed the leak.

Thanks for all your help.
--~--~---------~--~----~------------~-------~--~----~
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