1 comments

  • deathanatos6 minutes ago
    I&#x27;m coming predominately from other languages, so it took me a hot minute to figure out what the various bug were.<p>• channels are by default &quot;unbuffered&quot;, in that a send needs a waiting recv to actually do the send, and blocks until such. The addition of the buffer prevents the block &amp; permits the goroutine to progress (and eventually exit, and thus, not leak) … so long as the buffer is sufficiently large enough.<p>• channels do not, AFAICT, realize when the receiver is gone, and will block indefinitely even when there is no receiver. (It is the same &quot;chan&quot; object, I think, in both sender&#x2F;receiver &#x2F; there is no distinction. So, the single object is never GC&#x27;d.)<p>• goroutines are not GC&#x27;d. (&amp; the code doesn&#x27;t&#x2F;can&#x27;t hold like, a reference or a handle to a goroutine &#x2F; there is no &quot;join&quot; primitive.)