Description
Version
Media3 main branch
More version details
Media3 1.4.1
Devices that reproduce the issue
Google Pixel 4a running Android 13
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
- Click "OPEN VIEW PAGER ACTIVITY" on demo-shortform app
- Exit ViewPagerActivity
- Repeat the above steps
Expected result
No OOM and No crash
Actual result
Memory usage is increasing and then:
FATAL EXCEPTION: main Process: androidx.media3.demo.shortform, PID: 27397 java.lang.OutOfMemoryError: Failed to allocate a 120 byte allocation with 98000 free bytes and 95KB until OOM, target footprint 268435456, growth limit 268435456; giving up on allocation because <1% of heap free after GC. at android.content.res.AssetManager.nativeGetSizeConfigurations(Native Method) at android.content.res.AssetManager.getSizeConfigurations(AssetManager.java:1451) at android.content.res.ResourcesImpl.getSizeConfigurations(ResourcesImpl.java:203) at android.content.res.Resources.getSizeConfigurations(Resources.java:2207) at android.app.ActivityThread.reportSizeConfigurations(ActivityThread.java:3837) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3817) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2308) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7898) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Media
No
Bug Report
- You will email the zip file produced by
adb bugreport
to android-media-github@google.com after filing this issue.
Activity
tianyif commentedon Oct 28, 2024
Hi @bang919,
Thanks for reporting! I used the same device model, OS and library version (1.4.1), and repeated the provided steps for several times, but still couldn't reproduce. Did you change any configurations in
DefaultLoadControl
before seeing the issue?bang919 commentedon Oct 28, 2024
Hi @tianyif ,
Thanks for the response! I haven't changed any configurations in DefaultLoadControl (see Fig. 1). After repeatedly opening and closing the ViewPagerActivity, I noticed that multiple PlayerViews persist, even after garbage collection has been executed. I'll attach a screenshot for reference.
tianyif commentedon Oct 29, 2024
Thanks @bang919 for the useful information!
I saw that the corresponding
ViewHolder
s are still alive even when theViewPagerActivity
is stopped and GC is executed. I will provide a fix to this.Resolve the memory leaks in demo short-form app
Resolve the memory leaks in demo short-form app
Resolve the memory leaks in demo short-form app
Resolve the memory leaks in demo short-form app