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

Memory Issue #42

Open
ztrktunahan opened this issue Jul 7, 2021 · 5 comments
Open

Memory Issue #42

ztrktunahan opened this issue Jul 7, 2021 · 5 comments

Comments

@ztrktunahan
Copy link

After a certain number of videos have been downloaded, the application is terminated by memory error. For this, can we save the downloaded data to disk instead of memory?

If we can't do this, can you help us how to remove the downloaded data from memory? (I know that the data is not cached, but as long as the application is open, the downloaded data is kept in memory, causing memory issue)

@neekeetab
Copy link
Owner

The data is stored in ResourceLoaderDelegate.mediaData. Technically, when you lose the reference to the CachingPlayerItem it should be released from the memory along with all of it's internals.

There may be memory leaks causing the issues you're describing. I would add deinits to ResourceLoaderDelegate and CachingPlayerItem, make sure that they get called, and troubleshoot from there.

If you find there's a bug in the implementation, please report it

@ztrktunahan
Copy link
Author

I tried it but can not achieved this. Can you give example to add &c call deinits to ResourceLoaderDelegate and CachingPlayerItem.

@mohamedrafi-rapid
Copy link

I also want to remove the cached items. Please help

@neekeetab
Copy link
Owner

There's no caching done by CachingPlayerItem. It only gives you the raw Data via a delegate, and it's up to you how to cache it (and how to delete it from your cache).

@NickBrinsmade
Copy link

Hi, so I'm working in SwiftUI. I added prints to the existing CachingPlayerItem class and then the contained class ResourceLoaderDelegate. In my case it looks like the CachingPlayerItem deinit is fired every second--is this the correct behavior? For every deinit CachingPlayerItem that is fired, there is a ResourceLoaderDelegate deinit that is fired as well.

I'm getting a Memory error in the processPendingRequests() function when it tries to map the pending requests.

Not sure why exactly this error would be happening. All I've done is replaced all my existing AVPlayer(url:) structs with AVPlayer(playerItem:) structs instead. Should the cache be working in this situation? Not sure how to continue debugging because I don't understand the module 100%. Any help is much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants