playgameservices / android-basic-samples

Google Play game services - Android samples
Apache License 2.0
970 stars 973 forks source link

Activity leak from com.google.android.gms.games.internal.GamesClientImpl$RoomBinderCallbacks.zzbaP #247

Open reytum opened 7 years ago

reytum commented 7 years ago

I used LeakCanary to check for memory leaks. Although i am restarting the activity after end of every game it still shows a memory leak.

Play services and games version both - 10.2.4

The following is the dump given by leak canary:

claywilkinson commented 7 years ago

Thanks for the information - I'll pass it along to the SDK team.

reytum commented 7 years ago

There are few other listeners too that are leaking the activity: RoomBinderCallbacks: RoomUpdateListener RoomStatusUpdateListener RealTimeMessageReceivedListener

InvitationReceivedBinderCallback: OnInvitationReceivedListener

The docs says that the lifecycle of the room listeners depends on the GoogleAPiClient object and as it is disconnected these listners should release the reference to the activity, but they still leak.

The OnInvitationReceivedListener still leaks even after unregistering it.