-
Notifications
You must be signed in to change notification settings - Fork 238
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
Memory leak #64
Comments
Thanks for reporting this. As a workaround, could you dismiss all Snackbars on your |
I don't think that dismissing a snackbar eliminates the memory leak. As I see from the source code removeCallbacks(mDismissRunnable) is only called when swiping a snackbar. So if I would call dismiss() in onPause() a reference to the activity is still exists and will be only destroyed when Runnable in postDelayed() is fired. |
I see. Will upload a version shortly with the call in |
Released in 2.7.4 |
I use a snackbar with the custom duration 10 sec. If a user presses Back when a snackbar is showing, then the activity is finished but it cannot be garbage collected because there is a strong reference to it from the handler queue (due to postDelayed() method call):
Handler -> mDismissRunnable -> Snackbar (outer class) -> Activity
I think it is needed to call removeCallbacks(mDismissRunnable); from onDetachedFromWindow(), for example.
The text was updated successfully, but these errors were encountered: