Nope, that doesn't make any difference; if something's keeping hold of the head, it isn't the take:
=> (first (drop 19999999 (add-ch))) OutOfMemoryError Java heap space clojure.lang.RT.cons (RT.java:552) => (first (drop 19999999 (add-layer))) OutOfMemoryError Java heap space java.lang.AbstractStringBuilder.<init> (AbstractStringBuilder.java:45) On Fri, Jun 8, 2012 at 11:32 AM, Chris Perkins <chrisperkin...@gmail.com>wrote: > On Thursday, June 7, 2012 1:53:30 PM UTC-4, Tom Hume wrote: >> >> Hi >> >> I'm trying to generate a sequence which corresponds to a breadth-first >> search of a very wide, deep tree... and I'm hitting memory problems when I >> go too far along the sequence. Having asked around on the IRC channel and >> looked here, the number 1 cause of such problems is inadvertently holding >> onto the head; but I can't see where I'm doing this. >> >> (dorun (take 20000000 (add-layer))) >> > take holds on to the head, because that is what it returns. Try changing > take to drop. > > - Chris > > > -- > 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 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