From: Brad Fitzpatrick Date: Fri, 20 May 2016 22:43:14 +0000 (+0000) Subject: time: document that After uses memory until duration times out X-Git-Tag: go1.7beta1~133 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7ab698b0221fd4a5b2842fb50a34ba8a5f49c6d5;p=gostls13.git time: document that After uses memory until duration times out Fixes #15698 Change-Id: I616fc06dcf04092bafdaf56fb1afba2a998a6d83 Reviewed-on: https://go-review.googlesource.com/23304 Reviewed-by: Ian Lance Taylor --- diff --git a/src/time/sleep.go b/src/time/sleep.go index c348366604..7661f7e54f 100644 --- a/src/time/sleep.go +++ b/src/time/sleep.go @@ -106,6 +106,9 @@ func sendTime(c interface{}, seq uintptr) { // After waits for the duration to elapse and then sends the current time // on the returned channel. // It is equivalent to NewTimer(d).C. +// The underlying Timer is not recovered by the garbage collector +// until the timer fires. If efficiency is a concern, use NewTimer +// instead and call Timer.Stop if the timer is no longer needed. func After(d Duration) <-chan Time { return NewTimer(d).C }