android-basic-samples icon indicating copy to clipboard operation
android-basic-samples copied to clipboard

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

Open reytum opened this issue 7 years ago • 2 comments

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:

  • app.reytum.com.seep.activities.HomePage has leaked:

  • GC ROOT com.google.android.gms.games.internal.GamesClientImpl$RoomBinderCallbacks.zzbaP

  • references com.google.android.gms.internal.zzabh.mListener

  • leaks app.reytum.com.seep.activities.HomePage instance

  • Retaining: 6.9 MB.

  • Reference Key: 14b1cf29-b8d3-4cac-89b2-5edbfc139a93

  • Device: motorola motorola condor aosp_condor

  • Android Version: 6.0.1 API: 23 LeakCanary: 1.5.1 1be44b3

  • Durations: watch=5279ms, gc=174ms, heap dump=9470ms, analysis=71247ms

  • Details:

  • Instance of com.google.android.gms.games.internal.GamesClientImpl$RoomBinderCallbacks | zzbaP = com.google.android.gms.internal.zzabh@322736320 (0x133c90c0) | zzbaQ = com.google.android.gms.internal.zzabh@322736384 (0x133c9100) | zzbaR = com.google.android.gms.internal.zzabh@322736448 (0x133c9140) | mDescriptor = java.lang.String@319476480 (0x130ad300) | mObject = -1191870776 | mOwner = com.google.android.gms.games.internal.GamesClientImpl$RoomBinderCallbacks@323802064 (0x134cd3d0) | shadow$klass = com.google.android.gms.games.internal.GamesClientImpl$RoomBinderCallbacks | shadow$monitor = 0

  • Instance of com.google.android.gms.internal.zzabh | mListener = app.reytum.com.seep.activities.HomePage@315872640 (0x12d3d580) | zzaCX = com.google.android.gms.internal.zzabh$zza@322736352 (0x133c90e0) | zzaCY = com.google.android.gms.internal.zzabh$zzb@323805680 (0x134ce1f0) | shadow$klass = com.google.android.gms.internal.zzabh | shadow$monitor = -2143147770

  • Instance of app.reytum.com.seep.activities.HomePage | static RC_SELECT_PLAYERS = 1001 | static CLICKABLES = int[8]@316350912 (0x12db21c0) | static isDev = java.lang.Boolean@1886636232 (0x7073c8c8)

reytum avatar Jun 02 '17 12:06 reytum

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

claywilkinson avatar Jun 08 '17 16:06 claywilkinson

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.

reytum avatar Jun 10 '17 15:06 reytum