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
Fix android leaks #2141
Fix android leaks #2141
Conversation
My last commit also ensure that |
a5fac81
to
5107c68
Compare
This has now been tested on Android 9 as well.
I also removed my commit replacing the byte-copy loops with |
@renchap thanks for the changes! Please resolve conflicts. Will review/merge then. |
Streams and file descriptors needs to be closed when no longer used. I converted those to try-with-resources syntax, so they are automatically closed after the block ends.
…so let's use a custom wrapper around it
5107c68
to
17b904c
Compare
🎉 This PR is included in version 5.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Motivation (required)
While working on solving #2138, @huextrat noticed that the various streams and descriptors were never closed.
This is leaking a lot of resources.
I converted those to try-with-resources syntax, so they are automatically closed after the block ends.
Test Plan (required)
I tested various files and videos with the example app, and did not notice any issue.
I also enabled
StrictMode
on the example app (see https://wh0.github.io/2020/08/12/closeguard.html) and it no longer detects non-closed resources.