Fork me on GitHub
#core-async
<
2015-11-18
>
ska16:11:50

Is there any information anywhere on when go loops and the like get garbage collected? A lot of tutorials create never-ending loops and I wonder where the references to them are stored. Do they belong to the channel and get GCed when the channels goes away? Are we responsible for detecting the closing of the channel and ending the loop?

Lambda/Sierra19:11:31

@ska: go blocks are attached to whatever channel they are currently "parked" on. When the channel is eligible for GC, so is the go block. In general, it is a good idea to have a termination condition in a go loop that stops when the channel is closed.

Lambda/Sierra19:11:49

There is no global registry of go blocks.