New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bugfix: deadline.Set() memory leak (issue #208) #209
Conversation
Codecov ReportBase: 84.39% // Head: 84.41% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## master #209 +/- ##
==========================================
+ Coverage 84.39% 84.41% +0.02%
==========================================
Files 31 31
Lines 2691 2695 +4
==========================================
+ Hits 2271 2275 +4
Misses 315 315
Partials 105 105
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Signed-off-by: Jeremiah Millay <jmillay@fastly.com>
53ce2cd
to
5bb3974
Compare
Why is that needed? I'd just say Other than that, the patch looks correct to me. |
@jech this is the documented best practice for draining the timer's channel after calling stop. See here: |
@jech this is the documented best practice for draining the timer's channel
after calling stop. See here:
https://pkg.go.dev/time#Timer.Stop
Ah, in case the timer is shared between goroutines. No objection, then.
|
@jech do you need me to do anything further here? Looks like the CI workflow is stuck pending approval. |
You need approval from one of the Pion members. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @floatingstatic,
looks good to me! Thank you for fixing this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks also good to me 👍
Signed-off-by: Jeremiah Millay jmillay@fastly.com
Description
Use
time.Newtimer()
paired withtimer.Stop()
to avoid leaking memory withtime.After()
whose underlying timer will not be released to the garbage collector until it has fired.Reference issue
Fixes #208