On Jan 12, 2009, at 17:11, samppi wrote:

> Awesome—thanks for everyone's answers; I think I'll go with delay/
> force. What I'm a little worried about is the caching. After a calling
> of "alt" finishes, what happens to all those Delay objects and their
> cached values? Are they garbage-collected, or will they remain
> indefinitely? Should I worry?

They will be garbage-collected as soon as there is no more reference  
to the cached value. You needn't worry about this any more than for  
any other data item.

What can become problematic (as has been discussed here recently) is  
very long or even infinite lazy sequences that are being cached. If  
some variable anywhere in the program holds on to a reference to the  
first item, then the calculated values will remain cached forever  
since nothing can be garbage collected.

Konrad.



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