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

demo-shortform: When opening ViewPagerActivity multiple times, OOM occurs #1839

Open
1 task done
bang919 opened this issue Oct 27, 2024 · 3 comments
Open
1 task done
Assignees

Comments

@bang919
Copy link

bang919 commented Oct 27, 2024

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

  1. Click "OPEN VIEW PAGER ACTIVITY" on demo-shortform app
  2. Exit ViewPagerActivity
  3. 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

@tianyif
Copy link
Contributor

tianyif commented 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
Copy link
Author

bang919 commented 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.

WX20241029-012406
WX20241029-012718

@tianyif
Copy link
Contributor

tianyif commented Oct 29, 2024

Thanks @bang919 for the useful information!

I saw that the corresponding ViewHolders are still alive even when the ViewPagerActivity is stopped and GC is executed. I will provide a fix to this.

copybara-service bot pushed a commit that referenced this issue Nov 13, 2024
Issue: #1839
#cherrypick
PiperOrigin-RevId: 696080063
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants