Skip to content
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

Snackbar leaks activity #125

Closed
martinvandzura opened this issue May 14, 2015 · 6 comments
Closed

Snackbar leaks activity #125

martinvandzura opened this issue May 14, 2015 · 6 comments

Comments

@martinvandzura
Copy link

Version 2.10.+ (2.10.8)
Snackbar leaks activity if activity is closed while snackbar is visible.

GC ROOT static com.nispok.snackbar.SnackbarManager.currentSnackbar
* references com.nispok.snackbar.Snackbar.mTargetActivity
* leaks com.example.MainActivity instance

Snackbar is displayed in activity:
SnackbarManager.show(Snackbar.with(this).type(SnackbarType.MULTI_LINE).text("text"));
//dismissing onPause doesn't solve issue
onPause(){
SnackbarManager.dismiss();
}

@existz
Copy link

existz commented May 20, 2015

I get this as well when using SnackbarManager, so I reverted back to the normal Snackbar class which does not leak the activity.

@shayousefi
Copy link

My leak trace seems a little more specific:

* GC ROOT static com.nispok.snackbar.SnackbarManager.currentSnackbar
* references com.nispok.snackbar.Snackbar.snackbarText
* references android.support.v7.widget.AppCompatTextView.mContext
* leaks ...activities.NowActivity instance

@sam-ghosh
Copy link

I see similar as well:

05-20 11:49:24.893 25902-26313/com.gmspartnersltd.earthmiles.debug D/LeakCanary﹕ In com.gmspartnersltd.earthmiles.debug:1.6:6.
* com.gmspartnersltd.earthmiles.views.MainActivity has leaked:
* GC ROOT static com.nispok.snackbar.SnackbarManager.currentSnackbar
* references com.nispok.snackbar.Snackbar.mContext
* leaks com.gmspartnersltd.earthmiles.views.MainActivity instance
* Reference Key: 3f9851c5-7028-4f47-90ff-045ed815b178
* Device: Genymotion generic Google Nexus 5 - 5.0.0 - API 21 - 1080x1920 vbox86p
* Android Version: 5.0 API: 21
* Durations: watch=5008ms, gc=116ms, heap dump=772ms, analysis=5015ms

@wmora
Copy link
Contributor

wmora commented May 20, 2015

SnackbarManager should handle the context as a weak reference :-/

@UglyTroLL
Copy link

+1

@nalmada
Copy link

nalmada commented May 24, 2015

Noticied the memory leak too when using SnackManager

@wmora wmora closed this as completed in 4c40731 May 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants