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)))
(dorun (take 20000000 (add-layer)))
take holds on to the head, because that is what it returns. Try changing take to drop.
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)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@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+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en