laotoutou
laotoutou
“上面的代码有严重的内存泄漏问题,出错的位置是 go fn(i),实际上代码执行后会启动 4 个协程,但是因为 ch 是非缓冲的,只可能有一个协程写入成功。而其他三个协程会一直在后台等待写入。” ``` type query func(string) string func exec(name string, vs ...query) string { ch := make(chan string) fn := func(i int) { ch
> 空的channel是什么意思? 应该ch := make(chan string, 1)
明白了,谢谢 引用别人的话: “无缓冲的 就是一个送信人去你家门口送信 ,你不在家 他不走,你一定要接下信,他才会走。 无缓冲保证信能到你手上 有缓冲的 就是一个送信人去你家仍到你家的信箱 转身就走 ,除非你的信箱满了 他必须等信箱空下来。 有缓冲的 保证 信能进你家的邮箱”
本地安装的话可以检查下是否配置了https_proxy代理,我也碰到这个问题了 ```unset http_proxy && unset https_proxy && unset ALL_PROXY```
> Why was this closed? :( ok, I reopened it, please review 👀
how do you fix it?