Fork me on GitHub
#core-async
<
2018-09-17
>
steveb8n13:09:45

noob question: I am using a channel in clojurescript. a normal/parked go-loop reads from the channel. when the channel is closed, I expect to see a final nil value in the take but I see nothing. I’m worried that this will be a memory leak. Am I wrong to expect a final nil value when a channel is closed?

leonoel13:09:27

you're right to expect a nil value, but that doesn't necessarily imply a memory leak

leonoel13:09:22

channels don't need to be closed to be garbage collected

steveb8n13:09:57

that’s reassuring, thanks. it still leaves me wondering why I don’t see a nil. the docs clearly state a nil will be on the channel upon close!.

steveb8n13:09:42

on closer inspection I suspect I have a bug : noob mistake!

noisesmith16:09:29

it's never nil published to the channel - if a channel is closed every read gets a nil immediately on read