[Ffmpeg-devel] Memory leakage when using libavcodec with ffmpeg2theora

Bill May wmay
Thu May 12 19:56:32 CEST 2005


You might want to rerun the test with show-reachables=yes; this
will give you a dump of where the memory that is reachable is
malloced.

I think you'll find that these are static defines, not reoccurring;
with the version I'm using, the mallocs occur in MPV_encode_init,
line 596 of mpegvideo.c, the malloc of default_mv_penalty, which
should be done only 1 time.

A malloc that is only done 1 time is not fatal.

Viktor Kompaneyets wrote:
> ? ????????? ?? ???????, 12-???-2005 11:27 Peter Cech ???????(a):
> 
>>On Thu, May 12, 2005 at 10:39:02AM +0300, Viktor Kompaneyets wrote:
>>
>>>?? ?????????????????? ???? ??????????, 11-??????-2005 21:59 M?ns 
> 
> Rullg?rd ??????????????(a):
> 
>>>>So prove it.  The sample you provided decodes without leaving a single
>>>
>>>But running ffmpeg on the same stream (i told about 250M file, not 60M
>>>one!) shows memory leakage. Smaller, but visible!
>>
>>Can you rerun the test with valgrind? Posting leakage report should be
>>motivating enough for somebody to try your 250M file.
> 
> 
> ==9134== Memcheck, a memory error detector for x86-linux.
> ==9134== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
> ==9134== Using valgrind-2.4.0, a program supervision framework for x86-linux.
> ==9134== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
> ==9134== For more details, rerun with: -v
> ==9134==
> ffmpeg version 0.4.9-pre1, build 4752, Copyright (c) 2000-2004 Fabrice Bellard
>   configuration:  --enable-gpl --disable-ffserver --enable-libogg 
> --enable-vorbis --disable-ffplay --with-lpthreads
>   built on Apr 22 2005 19:45:01, gcc: 3.3.5 (Debian 1:3.3.5-8)
> Input #0, mpeg, from 'test.mpg':
>   Duration: 00:06:50.7, start: 0.122289, bitrate: 4905 kb/s
>   Stream #0.0: Video: mpeg2video, 720x576, 25.00 fps, 4322 kb/s
>   Stream #0.1: Audio: mp2, 48000 Hz, stereo, 192 kb/s
> File '/dev/null' already exists. Overwrite ? [y/N] y
> Output #0, mpeg2video, to '/dev/null':
>   Stream #0.0: Video: mpeg2video (hq), 720x576, 25.00 fps, q=2-31, 4322 kb/s
>   Stream #0.1: Audio: mp2, 48000 Hz, stereo, 192 kb/s
> Stream mapping:
>   Stream #0.0 -> #0.0
>   Stream #0.1 -> #0.1
> Press [q] to stop encoding
> [mpeg2video @ 0x8361b98]invalid cbp at 10 33 bitrate=7756.6kbits/s
> [mpeg2video @ 0x8361b98]Warning MVs not available
> [mpeg2video @ 0x8361b98]concealing 135 DC, 135 AC, 135 MV errors
> frame=10277 q=0.0 Lsize=  389232kB time=410.8 bitrate=7761.7kbits/s
> video:379494kB audio:9627kB global headers:0kB muxing overhead 0.028452%
> ==9134==
> ==9134== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 23 from 1)
> ==9134== malloc/free: in use at exit: 65552 bytes in 2 blocks.
> ==9134== malloc/free: 178210 allocs, 178208 frees, 650595929 bytes allocated.
> ==9134== For counts of detected errors, rerun with: -v
> ==9134== searching for pointers to 2 not-freed blocks.
> ==9134== checked 1552400 bytes.
> ==9134==
> ==9134== LEAK SUMMARY:
> ==9134==    definitely lost: 0 bytes in 0 blocks.
> ==9134==      possibly lost: 0 bytes in 0 blocks.
> ==9134==    still reachable: 65552 bytes in 2 blocks.
> ==9134==         suppressed: 0 bytes in 0 blocks.
> ==9134== Reachable blocks (those to which a pointer was found) are not shown.
> ==9134== To see them, rerun with: --show-reachable=yes
> 
> So the small leak, 6 min MPEG2  ~65K lost.
> At long-run it will be fatal.
> 





More information about the ffmpeg-devel mailing list