On Feb 8, 5:13 pm, Jeffrey Straszheim <straszheimjeff...@gmail.com>
wrote:
> I have this piece of code:
>
> (defn- run-work-elements-in-parallel
>   "Runs a group of work elements in parallel. Returns an extended database."
>   [elements database]
>   (assert (set elements))
>   (let [[rec simp] (separate :recursive elements)
>         results-simp (pmap #(run-simple-work-element % database) simp)
>         results-rec (map #(run-recursive-work-element % database) rec)
>         results (concat results-simp results-rec)]
>     (preduce union (cons database results))))
>
> The exact details aren't important.
>
> The let bindings results-simp, results-rec, and results are each a lazy
> stream.  They can get quite large.  Assuming preduce can iterate over them,
> is binding them in the let statement stopping them from getting garbage
> collected?
>

No. The compiler clears locals on tail calls.

However, the parallel lib does everything with parallel arrays, so the
coll passed to it will be copied into an array.

Rich

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