GoDoc says
Stop the ticker to release associated resources
However, a stack frame is destroyed and GC collect allocated resource
on that frame. If we don't do ticker.Stop()
, what about the allocated
resource related to ticker? Like following code:
func startReloader(duration time.Duration, reloader an_sync.IReloader, datasource string) {
ticker := time.NewTicker(duration / 10)
<-ticker.C
//dosomething here
}
//here is ticker struct
type Ticker struct {
C <-chan Time // The channel on which the ticks are delivered.
r runtimeTimer
}
Do we still have a memory leak here?