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

The playerview retains its instance on a device rotation #4323

Closed
DKillWorld opened this issue May 30, 2018 · 4 comments
Closed

The playerview retains its instance on a device rotation #4323

DKillWorld opened this issue May 30, 2018 · 4 comments
Assignees

Comments

@DKillWorld
Copy link

DKillWorld commented May 30, 2018

Issue description

The playerView retains its instance even after activity is finished by calling finish(). The new instance is created everytime in onCreate(). You can observe this behaviour by rotating screen as well. This happenes until app crashes with OOM error.

Reproduction steps

Create playerView in XML, connect it with player instance in activity class. And rotate device or finish activity by transiting into any other one.

Link to test content

Will email you. It may happen with demo app too I guess, havnt tried though.

Version of ExoPlayer being used

V2.8.0

Device(s) and version(s) of Android being used

Xiaomi Redmi Note 5 Pro, Android 7.0

A full bug report captured from the device

Not needed. Just analyze java heap after each device orientation change. It keeps increasing until OutOfMemory Exception.

@ojw28
Copy link
Contributor

ojw28 commented May 30, 2018

This sounds like an application bug to me. It's your responsibility to release each player instance, by calling player.release(), as well as any references that your application code holds to it, when the instance is no longer required. The issue does not reproduce in the demo app.

@ojw28 ojw28 closed this as completed May 30, 2018
@ojw28 ojw28 self-assigned this May 30, 2018
@DKillWorld
Copy link
Author

DKillWorld commented May 30, 2018

I keep my player instance in Service, and I dont want it to be released on activity's ondestroy(). I just want my playerView reference to be cleared on activity rotation which is not happening right now.
I set playerView.setplayer(null) on activity ondestroy(). But its still not cleared from memory. I dont know why. Any suggestions??

@ojw28
Copy link
Contributor

ojw28 commented May 30, 2018

I don't understand what "The playerView retains its instance" means. It sounds like your application code is leaking something. Whatever you're seeing more instances of in the heap after every device orientation, you should trace the path from those instances to a GC root, which will show you the reference chain that's causing the leak. You need to fix that.

We're not able to assist debugging your code. If you can reproduce with our demo app then that would be evidence that it's an ExoPlayer issue, in which case please reply here with concrete reproduction steps.

@DKillWorld
Copy link
Author

Strangely enough, I fixed issue with just setting intent flag to Reorder_Front when switching between activities, and no more than 1 playerView instance in memory heap.

@google google locked and limited conversation to collaborators Nov 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants