通道未关闭(且不是引用)是否会导致内存泄漏?

时间:2020-03-27 07:52:08

标签: go

此处是时间包中time.Timer的文档。

它说Timer.Stop()不会关闭其内置频道。

Timer.C是只读的,因此无法手动关闭它?

问题是如果Timer不自己关闭它,谁会关闭?

通道没有关闭且没有可变点会导致内存泄漏吗?

// Stop prevents the Timer from firing.
// Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.
func (t *Timer) Stop() bool {

}

0 个答案:

没有答案