Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Memory leak on repeated play() calls via API #163

Closed
anssip opened this issue Dec 3, 2013 · 20 comments
Closed

Memory leak on repeated play() calls via API #163

anssip opened this issue Dec 3, 2013 · 20 comments
Assignees
Milestone

Comments

@anssip
Copy link
Contributor

anssip commented Dec 3, 2013

Flash's memory usage seems to continuously grow when calling play("video.mp4") via the API. Here is a test page that can be used to investigate this: https://github.com/flowplayer/flash/blob/dev/core/test/memoryleak.html

"I am running the Flash-based Flowplayer. After playing a few MP4 videos, Flash crashes
with the "gray circle of death" as described here:
http://blogs.adobe.com/dekesmith/2012/06/07/what-is-the-gray-circle-with-an[..]. According
to the Adobe blog post, this is Flash failing to allocate more memory from the browser.

I have run the memory profiler found in Flash Develop and it seems that each time I play
an MP4, flash allocates a fairly large amount of memory that never gets freed. After a few
videos, when Flash Develop shows that 200MB or thereabouts have been allocated, Flash
crashes."

@ghost ghost assigned danrossi Dec 3, 2013
@danrossi
Copy link
Contributor

danrossi commented Dec 3, 2013

I'm not seeing a problem if the api call is made in the correct place, the code above is basically a dos attack and creating a bottleneck from the looks of it.

onStart: function() {
console.log("onStart");
this.play("http://www.blacktrash.org/php/streamer.php/ccc_trailer1.flv");
},

or with http://pseudo01.hddn.com/vod/demo.flowplayervod/bbb-400.mp4

Need the actual video to test.

@danrossi
Copy link
Contributor

danrossi commented Dec 3, 2013

The garbage collector is being run very often and keeping memory in check.

danrossi added a commit that referenced this issue Dec 7, 2013
…d clear all timer events and listeners where completed, use weak references when unable to set listener method callbacks, initialise and reset playlist clips list, reset screen display list when changing playlists. stop and close the connection and stream when replacing clips.
@danrossi
Copy link
Contributor

danrossi commented Dec 7, 2013

There was a bit of surgery required so needs testing but it looks ok to me.

danrossi added a commit that referenced this issue Dec 7, 2013
danrossi added a commit that referenced this issue Dec 9, 2013
…th directly adding clips and in stream clips on the playlist changes.

- #163 disable error dispatches on the animation library around the easing setter.
@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

These fixes are now merged and in dev94. Thre's still a problem in this demo: http://flash.dev94.flowplayer.us/demos/configuration/instream-playlist.html

it does not continue playing after the midroll finishes.

@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

Buffering animation is stuck after pause here: http://flash.dev94.flowplayer.us/demos/configuration/playlist-splash.html

@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

Exception is thrown here http://flash.dev94.flowplayer.us/demos/plugins/javascript/playlist/youtube.html

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at org.flowplayer.model::Playlist/doReplace()
    at org.flowplayer.model::Playlist/replaceClips2()
    at org.flowplayer.controller::PlayListController/http://flowplayer.org/core/internal::setPlaylist()
    at org.flowplayer.view::FlowplayerBase/setPlaylist()
    at MethodInfo-861()

@danrossi
Copy link
Contributor

Yes I know where it is, perhaps its not the best place for this here, but i believe the stream needs to be detached from the current video before replacement also to help clear display and network buffers. i'll try something that will work.

@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

Please check the other issues also, i found 3 problems, all listed above 😄

danrossi added a commit that referenced this issue Dec 10, 2013
… controller , there are two playlist replacement features to handle it in.
@danrossi
Copy link
Contributor

it's hard to determine it now it wasn't ready for merging. the other problems are probably events.

#175

@danrossi
Copy link
Contributor

I just recompiled a few times and was able to get instream working. It's being added correctly for me.

anssip added a commit that referenced this issue Dec 10, 2013
- fixes for #163 clear the stream on clip content within the playlist co...
@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

Merged now. It will build to dev94 and i'll test once it's done.

@danrossi
Copy link
Contributor

cannot replicate either of those. the playlist plugin issue has been fixed up.

@anssip
Copy link
Contributor Author

anssip commented Dec 10, 2013

No exception here any more: http://flash.dev94.flowplayer.us/demos/plugins/javascript/playlist/youtube.html

With Mac Safari the buffer animation is still stuck here: http://flash.dev94.flowplayer.us/demos/configuration/playlist-splash.html One way to solve this is to have a "start detect timer" in the PlayButtonOverlayView that monitors if the playback time starts moving and hides the buffer animation, something similar to this https://github.com/flowplayer/flash/blob/master/plugins/controls/src/actionscript/org/flowplayer/controls/scrubber/ScrubberSlider.as#L257

@danrossi
Copy link
Contributor

Yes got it it's being garbage collected I will turn the listener on and off manually. something is unruly with safari now it seems.

danrossi added a commit that referenced this issue Dec 10, 2013
@danrossi
Copy link
Contributor

it seems to be fine now.

@danrossi
Copy link
Contributor

I believe this is a buffer empty event after unpausing it will clear after its done. There is some shotty power management thing in mavericks safari which is doing this. Its not buffering progressive download. I can't really figure what it's doing because I can't even see the logs in safari either it's showing up empty / clear / white so a bug with safari. This might take some time and I doubt its got anything to do with these changes.

@danrossi
Copy link
Contributor

it's happening in chrome also and its because of another timer event set as weak reference will have to reconfigure its listener setup. will test in chrome and it should work in safari.

@danrossi
Copy link
Contributor

ok its random. within that file there is some playback timer tracker to stop the buffer animation after 200ms of playback. What was this for exactly ?

@danrossi
Copy link
Contributor

ok something is up for some reason clearing the timer reference when its stopped and completed helps and leave weak references on the listener is ok.

Playback and buffering progressive download in general is bad in safari which seems to reflect the changes in IOS7 also it's wierd. It looks like some network bug to me in safari no idea.

@danrossi
Copy link
Contributor

looks better now, but this weak reference stuff might need to be moved to external listeners instead. instream looks better now.

@anssip anssip closed this as completed Dec 11, 2013
danrossi added a commit that referenced this issue Jan 17, 2014
- #197 don’t set to silent when stopping the stream when replaying playlists, this causes some issues.
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