-
Notifications
You must be signed in to change notification settings - Fork 396
When using the player inside a program, memory isn't freed afterwards. #22
Comments
I've run the code through valgrind, and this is the output: http://dream-code.se/temp/valgrind.txt ==8789== LEAK SUMMARY: The problem here is: "still reachable". The program I'm writing is giving the option to select between many different tutorial movies, However, for this to work smoothly, the "still reachable" memory has to be freed, or else the user will be out of memory after playing only a few video files. If someone could help fix this problem I would be very grateful! |
Is this a problem with the tutorials or with the ffmpeg library itself? On 27 February 2014 18:24, solarstrings [email protected] wrote:
|
I'm trying with different builds, both latest and the older one which comes with Enlightenment OS Luna (basically Ubuntu 12.04). Installed from repository. Anyway! Quoted from: http://wiki.libsdl.org/SDL_WaitThread There are two SDL_CreateThreads in the code, but SDL_WaitThread is not called, thus resulting in resource leak. I played a 25 min long anime episode, and the allocated memory constantly kept growing. It started at about 70MB of allcoated memory and grew to 90+ MB. The same thing does not happen with ffplay. //-------------
It's the tutorials, because ffplay doesn't leak memory. Sure, for a "command-line" player which plays one video file, it's somewhat "ok"... the "still reachable memory" will be free for access again once the program closes (handled by the OS), but if you want to play many different videos, in a row, it's not acceptable. |
Can you confirm that calling SDL_WaitThread resolves the problem? On 28 February 2014 05:04, solarstrings [email protected] wrote:
|
Hi!
I took the player (tutorial07.c), changed the main into: playVideoFile(char *filename); by simply exchanging argv to filename. Everything works, but when exiting the player function, the memory isn't freed.
In order to get audio to play the second time you want to play a movie within your program, you need to call SDL_CloseAudio(); in the SDL_QUIT event, like so:
otherwise the audio won't play the 2nd time you start a video.
I'm trying to find what memory to free, but I'm new to thread programming (just started learning them by writing a web server in C for a Lab at the university), so I haven't found what to free yet.
When playing a video, it allocates the memory it needs, then stays there. And when closing down the
video, the memory is still allocated, in my case around 72Mb
The text was updated successfully, but these errors were encountered: