Skip to content

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

Open
@bang919

Description

@bang919

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

  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Activity

tianyif

tianyif commented on Oct 28, 2024

@tianyif
Contributor

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

bang919 commented on Oct 28, 2024

@bang919
Author

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

tianyif commented on Oct 29, 2024

@tianyif
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @tianyif@bang919

      Issue actions

        demo-shortform: When opening ViewPagerActivity multiple times, OOM occurs · Issue #1839 · androidx/media