openFrameworks
openFrameworks copied to clipboard
ofVideoPlayer macOS memory leak
Using the video player example I am calling load every 10 seconds. Over time the memory builds up. I'm on macOS 10.12 with latest of_v0.10.0_osx_release.
Please look at screen shot to see file size, memory usage and load count.

Can you try running the program just as an application outside of XCode? Ie., Just double click the compiled app and monitor memory usage using the activity monitor. It may be a new/unrelated bug, but when I was developing a HAP AVFoundation add-on I chased a suspected memory leak for weeks only to discover that it was actually a bug with Xcode and video - the memory leak only occured when executing the app from Xcode...
Same problem even without Xcode. Strange that loading a 340 MB video file with raw codec creates 80 MB memory increases.
I tried it also with OF 0.9.8 and on a different computer and see the same results. I guess since my video is very large I only notice it now and never before with much smaller files. But even smaller files (20MB) exhibit a slow memory build up.
In case someone wants to verify my findings. Here are my simple code and the video I'm testing with. https://www.dropbox.com/s/qj2fayxgs7m8dq7/videoPlayerExample.zip?dl=0
I can confirm the leak in Linux, ubuntu 16.04. Using the same example but switching between two different video Files. Memory usage continues to grow.
@arturoc @roymacdonald

I've built a custom video player that runs everyday, loading a new video each 10 seconds, and it freezes the computer after about 12 or 13 hours. Maybe it is related to this issue. I'll try to load a vector of videos to avoid calling load function a thousand times and see if it runs OK.
I'm just linking a forum post that seems to run on the same issues described here: https://forum.openframeworks.cc/t/memory-increases-at-each-rerun-how-to-free-it/37972/11
Hello @stephanschulz can you please try it again with the latest master? There are some recent changes in AVFoundationVideoPlayer which can help.

Was this ever fixed? We're running a video loop and the program crashes after a few hours. When we looked at the system memory over time it went from 6gb to 11gb over the play time of 11 hours. Using OF 0.11.2 osx release.
@itsgalo please test with latest nightly to see if it still happens. are you using macOS? if yes I've fixed an infinite threads issue before 0.12.0 release
@itsgalo I had the same kind of issue in the past, but not after 0.12. I'll be closing this one. Comment here if you have any similar issue with latest OF