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

Assistance diagnosing leak? #7

Closed
broakenmedia opened this issue May 9, 2015 · 4 comments
Closed

Assistance diagnosing leak? #7

broakenmedia opened this issue May 9, 2015 · 4 comments

Comments

@broakenmedia
Copy link

05-09 12:56:56.174  18379-19786/com.b.kD/LeakCanary﹕ In com.b.k:1.4.4.7:57.
* com.b.k.Add_User has leaked:
* GC ROOT android.app.LoadedApk$ServiceDispatcher$DeathMonitor.this$0
* references android.app.LoadedApk$ServiceDispatcher.mConnection
* references com.android.vending.billing.util.IabHelper$1.val$listener (anonymous class implements android.content.ServiceConnection)
* references com.b.k.Add_User$5.this$0 (anonymous class implements com.android.vending.billing.util.IabHelper$OnIabSetupFinishedListener)
* leaks com.b.k.Add_User instance
* Reference Key: c06d2f1f-b1ad-4419-b17b-d9d0e0eb10f7
* Device: Genymotion generic Google Nexus 4 - 4.2.2 - API 17 - 768x1280 vbox86p
* Android Version: 4.2.2 API: 17
* Durations: watch=5006ms, gc=107ms, heap dump=153ms, analysis=4607ms

Just want to say, this library is a godsend, the problem i'm having however is actually discerning the location/cause of the leak? Which line should i be focussing on in order to find the culprit here?

It almost looks as if its coming from Google's IAB helpers?

Thanks!

@pyricau
Copy link
Member

pyricau commented May 9, 2015

In Add_User, you call IabHelper.startSetup() with an anonymous class that implements IabHelper.OnIabSetupFinishedListener.

Do you call IabHelper.dispose() when Add_User is destroyed ?

Here is what the doc says:

 * When you are done with this object, don't forget to call {@link #dispose}
 * to ensure proper cleanup. This object holds a binding to the in-app billing
 * service, which will leak unless you dispose of it correctly. If you created
 * the object on an Activity's onCreate method, then the recommended
 * place to dispose of it is the Activity's onDestroy method.

@pyricau
Copy link
Member

pyricau commented May 9, 2015

If you indeed do already call IabHelper.dispose(), then it might be a more interesting leak. I'd need the heap dump to gather more info.

@broakenmedia
Copy link
Author

Fantastic, got it in one, thank you!

@icoolguy1995
Copy link

I am having the save issue, and I am calling helper.dispose(); in Ondestroy of my activity still leakcanary shows leak.

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

3 participants