[Ffmpeg-devel] Memory leak in output_example ... ?

Mat heavensdoor78
Wed Sep 21 16:40:28 CEST 2005


Hi all.
Again with  output_example.c ...
If I run  output_example  in valgrind or with mpatrol I got some memory 
advices.
I would like to use  output_example  as base for an application that 
produce many videos continusly but first I need to solve this problem.
I started to making the application and monitoring it with  ps  ( ps u 
-C myApp )  and I see an increment of the memory usage ( about 1% every 
4 hours )
It seems related to  av_new_stream  and  avcodec_open ...
Anyone can help me ?
Perhaps I could use another sample code... what can I use as base?

My test:
    valgrind --leak-check=yes --show-reachable=yes 
--log-file=valgrind.log ./output_example test.vob
Result:

=== valgrind.log ===

==10241== Memcheck, a memory error detector for x86-linux.
==10241== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==10241== Using valgrind-2.4.0, a program supervision framework for 
x86-linux.
==10241== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==10241==
==10241== My PID = 10241, parent PID = 3416.  Prog and args are:
==10241==    ./output_example
==10241==    test.vob
==10241== For more details, rerun with: -v
==10241==
==10241==
==10241== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 1)
==10241== malloc/free: in use at exit: 66984 bytes in 4 blocks.
==10241== malloc/free: 476 allocs, 472 frees, 2163416 bytes allocated.
==10241== For counts of detected errors, rerun with: -v
==10241== searching for pointers to 4 not-freed blocks.
==10241== checked 557072 bytes.
==10241==
==10241== 1432 bytes in 2 blocks are definitely lost in loss record 1 of 2
==10241==    at 0x1B905141: memalign (vg_replace_malloc.c:216)
==10241==    by 0x80A8BAE: av_malloc (mem.c:62)
==10241==    by 0x80A8384: avcodec_alloc_context (utils.c:768)
==10241==    by 0x80599A1: av_new_stream (utils.c:2179)
==10241==    by 0x805453C: add_video_stream (output_example.c:187)
==10241==    by 0x80552CE: main (output_example.c:447)
==10241==
==10241==
==10241== 65552 bytes in 2 blocks are still reachable in loss record 2 of 2
==10241==    at 0x1B905141: memalign (vg_replace_malloc.c:216)
==10241==    by 0x80A8BAE: av_malloc (mem.c:62)
==10241==    by 0x80A6F56: av_mallocz (utils.c:63)
==10241==    by 0x80B498B: MPV_encode_defaults (mpegvideo.c:596)
==10241==    by 0x80AA939: MPV_encode_init (mpegvideo.c:893)
==10241==    by 0x81C485F: encode_init (mpeg12.c:224)
==10241==    by 0x80A7663: avcodec_open (utils.c:832)
==10241==    by 0x80546A0: open_video (output_example.c:262)
==10241==    by 0x8054EB1: main (output_example.c:465)
==10241==
==10241== LEAK SUMMARY:
==10241==    definitely lost: 1432 bytes in 2 blocks.
==10241==      possibly lost: 0 bytes in 0 blocks.
==10241==    still reachable: 65552 bytes in 2 blocks.
==10241==         suppressed: 0 bytes in 0 blocks.





More information about the ffmpeg-devel mailing list