]> Cypherpunks repositories - gostls13.git/commitdiff
time: document that time.Tick creates an unrecoverable resource
authorRob Pike <r@golang.org>
Mon, 13 Jul 2015 01:13:15 +0000 (11:13 +1000)
committerRob Pike <r@golang.org>
Mon, 13 Jul 2015 01:35:36 +0000 (01:35 +0000)
Fixes #11662.

Change-Id: I8839b48a1cd3da4c29b6def03cb0c74c1c12942e
Reviewed-on: https://go-review.googlesource.com/12066
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/time/tick.go

index 19007841e1af045821168cbde5faf6322dfda6ad..196e8ac61a6da384f6f12ace65f05a921e264ed1 100644 (file)
@@ -47,7 +47,9 @@ func (t *Ticker) Stop() {
 }
 
 // Tick is a convenience wrapper for NewTicker providing access to the ticking
-// channel only.  Useful for clients that have no need to shut down the ticker.
+// channel only. While Tick is useful for clients that have no need to shut down
+// the Ticker, be aware that without a way to shut it down the underlying
+// Ticker cannot be recovered by the garbage collector; it "leaks".
 func Tick(d Duration) <-chan Time {
        if d <= 0 {
                return nil