[FFmpeg-devel] Longevity Test Report

Benjamin Larsson banan
Wed Feb 4 13:55:19 CET 2009

Reimar D?ffinger wrote:
> On Wed, Feb 04, 2009 at 12:00:53PM +0100, Benjamin Larsson wrote:
>> My suggestion to find these kind of problems is to wrap av_malloc in a 
>> macro that expands av_malloc to av_leak_malloc(size,__FILE__,__LINE).
> There are more than enough tools that do that already, only that most
> suck. Please spend your efforts on fixing/improving those general
> solutions instead implementing you own and very limited version.
> Also the issue is not really a leak otherwise valgrind would probably
> work fine (even if a little slow, and not on Windows).

Sure there are tools but how many are easy to use with FFmpeg on all 
platforms can be used on ?

>> I know at least one ticket where this kind of tool would have helped 
>> alot. Or we could use memwatch.
> Neither your suggestions nor memwatch allow to get a backtrace AFAICT.

Well the aim wasn't to get backtraces, just a list with allocations 
during runtime when memory usage is high.

> Considering that, just gdb alone seems to be able to do what you want
> and far more (start program with gdb, STRG+C when you want to start
> debugging, breakpoint on malloc, see where it hangs more often.
> If there are a lot of mallocs, use e.g. "c 100" for continuing to get a
> statistical sampling. I am sure more advanced stuff is possible using
> conditional breakpoints, but I never had to resort to that)

The main aim for this kind of tool is to enable developers an easy way 
to track memory usage. But if it won't be accepted into the codebase 
because of technical merits I'm not going to waste my time with it.

And regarding memwatch it wasn't so suitable for this kind of task.

Benjamin Larsson

More information about the ffmpeg-devel mailing list