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
x/mobile/exp/sensor: Manager should close itself during finalization #12169
Comments
Finalization is an expensive option with no promptness guarantees. If a On Mon, Aug 17, 2015 at 2:41 PM, Burcu Dogan notifications@github.com
|
Rick, Burcu, can't we support both methods for closing? On Mon, Aug 17, 2015 at 3:08 PM, Richard L. Hudson <notifications@github.com
|
The downside is the memory leak. Each sensor.Manager allocates several underlying resources. We debated finalization vs Closer interface a couple of times in different contexts for the mobile project. In this particular case, I would prefer not to implement io.Closer because it is fine not to have a guarantee -- the leak is not expensive. The only concern is the unexpected finalizations as it was the case at #10636. sensor.Manager instances are likely to be long-living, similar to al.Context. |
Designing an API where a piece of code may or may not run and if it does it Currently (1.5) managing finalization happens during the stop the world Offering both seems reasonable, if the memory being leaked becomes a bigger On Mon, Aug 17, 2015 at 3:28 PM, Burcu Dogan notifications@github.com
|
We are planning to move to a new design where we won't allow multiple instances of Manager. Given the feedback, if we have to reconsider the previous APIs, I am going to be offering a finalizer as an addition to Close. Closing the issue due to obsoleteness. |
Users are required to explicitly close the Manager by invoking (*Manager).Close, but the same action could be handled during finalization without user having to explicitly call Close.
The text was updated successfully, but these errors were encountered: