It appears I'm not understanding how something works in the REPL (or
maybe deeper).  For instance:

(def big (range 10000000))
; memory is small now
(count big) => 10000000
; memory is huge now
(System/gc)
; memory is still huge now
(def big nil)
(System/gc)
; memory is small again

So somehow when count "realizes" big, I'm guessing it gets memoized
and stuck in some sort of cache attached to the var big.

If I:

(do (System/gc) (count (range 10000000)) (System/gc))
; memory is small before and after

I think the version I wrote originally is fine; I just wasn't testing
it properly.  Sorry to bother folks!

Mike

-- 
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