Fixed
Status Update
Comments
fr...@gmail.com <fr...@gmail.com> #2
I am experiencing the same problem on multiple devices using 23.2.0
fr...@gmail.com <fr...@gmail.com> #3
Hi,
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
Thanks
al...@gmail.com <al...@gmail.com> #4
This appears to specifically impact Android 5 and 6, but is ok on Android 4
sm...@gmail.com <sm...@gmail.com> #5
Same problem here.
fr...@gmail.com <fr...@gmail.com> #7
[Comment deleted]
fr...@gmail.com <fr...@gmail.com> #8
This is a bug, but the fitSystemWindows on the CoordinatorLayout is doing absolutely zero here. You can remove it and the bug will go.
am...@google.com <am...@google.com> #9
Hi,
The development team has fixed the issue that you have reported and it will be available in a future version.
Thanks
The development team has fixed the issue that you have reported and it will be available in a future version.
Thanks
sm...@gmail.com <sm...@gmail.com> #10
Leak canary doesn't require an APK. See https://github.com/square/leakcanary for how it works if you are unfamiliar.
You should also see the activity leak using Android Studio if you take a memory dump after visiting the AnotherActivity a few times and run activity leak detection.
However, I'm not sure why you need the reproduction because the ResultReceiver added in 25.1.0 is clearly the cause of the leak. The anonymous class holds an implicit reference to the MediaController. The media controller holds a reference to the context (activity) used to create it.
A better technique would be to create a static inner class of the ResultReceiver. When it is constructed the ResultReceiver should hold a WeakReference to the MediaController. This is because the ResultReceiver may outlive the object it was created with. Obviously onReceiveResult will have to see if the WeakReference still references the MediaController. If not, shouldn't do anything.
You should also see the activity leak using Android Studio if you take a memory dump after visiting the AnotherActivity a few times and run activity leak detection.
However, I'm not sure why you need the reproduction because the ResultReceiver added in 25.1.0 is clearly the cause of the leak. The anonymous class holds an implicit reference to the MediaController. The media controller holds a reference to the context (activity) used to create it.
A better technique would be to create a static inner class of the ResultReceiver. When it is constructed the ResultReceiver should hold a WeakReference to the MediaController. This is because the ResultReceiver may outlive the object it was created with. Obviously onReceiveResult will have to see if the WeakReference still references the MediaController. If not, shouldn't do anything.
il...@google.com <il...@google.com>
al...@gmail.com <al...@gmail.com> #11
[Comment deleted]
pe...@gmail.com <pe...@gmail.com> #12
I met the same problem when i chage the support from 25.0.1 to 25.1.0,LeakCanary warn the same message,so i change my code from:
mMdeMediaControllerCompat = new MediaControllerCompat(xxxActivity.this, mMediaBrowserCompat.getSessionToken());
to
mMdeMediaControllerCompat = new MediaControllerCompat(getApplicationContext(), mMediaBrowserCompat.getSessionToken());
After then,it is works,and LeakCanary won't warn that leak since then!
mMdeMediaControllerCompat = new MediaControllerCompat(xxxActivity.this, mMediaBrowserCompat.getSessionToken());
to
mMdeMediaControllerCompat = new MediaControllerCompat(getApplicationContext(), mMediaBrowserCompat.getSessionToken());
After then,it is works,and LeakCanary won't warn that leak since then!
dn...@google.com <dn...@google.com> #13
Issue is fixed and released in 25.2.0 support library.
Description
Version used: 25.1.0
Devices/Android versions reproduced on:
Nexus 4 Nougat API 25
The issues happens when the MediaControllerCompat is created with the token of the a MediaSessionCompat which has its lifecycle bind to the application.
Here is the LeakCanary log:
In br.com.me.mediacontrollercompatreprocase:1.0:1.
* br.com.me.mediacontrollercompatreprocase.AnotherActivity has leaked:
* GC ROOT android.os.ResultReceiver$MyResultReceiver.this$0
* references android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi21$1.this$0 (anonymous subclass of android.os.ResultReceiver)
* references android.support.v4.media.session.MediaControllerCompat$MediaControllerImplApi24.mControllerObj
* references android.media.session.MediaController.mContext
* leaks br.com.me.mediacontrollercompatreprocase.AnotherActivity instance
* Retaining: 48 KB.
* Reference Key: c72cb728-7e92-4fce-959a-b2a856ea7af6
* Device: unknown Android Android SDK built for x86_64 sdk_google_phone_x86_64
* Android Version: 7.1 API: 25 LeakCanary: 1.5 00f37f5
* Durations: watch=5013ms, gc=112ms, heap dump=3237ms, analysis=18682ms
For more details, you could use the following sample to reproduce it.