Code Monkey home page Code Monkey logo

Comments (4)

solarstrings avatar solarstrings commented on August 30, 2024

I've run the code through valgrind, and this is the output:

http://dream-code.se/temp/valgrind.txt

==8789== LEAK SUMMARY:
==8789== definitely lost: 52 bytes in 4 blocks
==8789== indirectly lost: 352 bytes in 8 blocks
==8789== possibly lost: 2,992 bytes in 11 blocks
==8789== still reachable: 12,059,503 bytes in 1,396 blocks
==8789== suppressed: 0 bytes in 0 blocks

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!

from ffmpeg-tutorial.

mpenkov avatar mpenkov commented on August 30, 2024

Is this a problem with the tutorials or with the ffmpeg library itself?
Speaking of which, which version of ffmpeg are you using?

On 27 February 2014 18:24, solarstrings [email protected] wrote:

I've run the code through valgrind, and this is the output:

http://dream-code.se/temp/valgrind.txt

==8789== LEAK SUMMARY:
==8789== definitely lost: 52 bytes in 4 blocks
==8789== indirectly lost: 352 bytes in 8 blocks
==8789== possibly lost: 2,992 bytes in 11 blocks
==8789== still reachable: 12,059,503 bytes in 1,396 blocks
==8789== suppressed: 0 bytes in 0 blocks

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!

Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-36224036
.

from ffmpeg-tutorial.

solarstrings avatar solarstrings commented on August 30, 2024

which version of ffmpeg are you using?

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.
Both latest build and the old one results in memory leak, try it with valgrind yourself.

Anyway!
I've been reading up on things, and one thing that needs to be added to the code is:
SDL_WaitThread.

Quoted from: http://wiki.libsdl.org/SDL_WaitThread
"Remarks
Wait for a thread to finish. Threads that haven't been detached will remain (as a "zombie") until this function cleans them up. Not doing so is a resource leak. "

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.

//-------------

Is this a problem with the tutorials or with the ffmpeg library itself?

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.

from ffmpeg-tutorial.

mpenkov avatar mpenkov commented on August 30, 2024

Can you confirm that calling SDL_WaitThread resolves the problem?

On 28 February 2014 05:04, 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.
Both latest build and the old one results in memory leak, try it with
valgrind yourself.

Anyway!
I've been reading up on things, and one thing that needs to be added to
the code is:
SDL_WaitThread.

Quoted from: http://wiki.libsdl.org/SDL_WaitThread
"Remarks
Wait for a thread to finish. Threads that haven't been detached will
remain (as a "zombie") until this function cleans them up. Not doing so is
a resource leak. "

There are two SDL_CreateThreads in the code, but SDL_WaitThread is not
called, thus resulting 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 happens with ffplay.

Is this a problem with the tutorials or with the ffmpeg library itself?

It's the tutorials, because they are based upon the code of ffplay, which
also doesn't free the allocate memory in the end. Sure, for a
"command-line" player, its 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.

Reply to this email directly or view it on GitHubhttps://github.com//issues/22#issuecomment-36284994
.

from ffmpeg-tutorial.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.