【发布时间】:2012-01-25 11:46:37
【问题描述】:
如果我从不检查 Go 通道的状态,是否可以让 Go 通道永远打开(永远不要关闭通道)?会不会导致内存泄露?下面的代码可以吗?
func (requestCh chan<- Request) GetResponse(data RequestData) Response {
reply := make(chan Response)
requestCh <- Request{data: data, replyCh: reply}
return <-reply
}
【问题讨论】: