[Ffmpeg-devel] possible memory leak?

Zoltan NAGY nagyz
Thu Jan 26 17:41:59 CET 2006


Zoltan NAGY wrote:
> M?ns Rullg?rd wrote:
>> Zoltan NAGY <nagyz at nefty.hu> writes:
>>
>>  
>>> ==24793== 84,329 (83,208 direct, 1,121 indirect) bytes in 72 blocks
>>> are definitely lost in loss record 9 of 9
>>> ==24793==    at 0x401CA6B: memalign (vg_replace_malloc.c:332)
>>> ==24793==    by 0x40E374E: av_malloc (in 
>>> /usr/local/lib/libavcodec-CVS.so)
>>> ==24793==    by 0x403F3D5: av_new_packet (in
>>> /usr/local/lib/libavformat-CVS.so)
>>> ==24793==    by 0x408EE37: rtp_parse_packet (in
>>> /usr/local/lib/libavformat-CVS.so)
>>> ==24793==    by 0x408CF49: (within /usr/local/lib/libavformat-CVS.so)
>>> ==24793==    by 0x404034A: (within /usr/local/lib/libavformat-CVS.so)
>>> ==24793==    by 0x804893D: main (avcodec_sample.0.4.9.cpp:44)
>>>
>>> so basically it sais I didnt free the result of av_read_frame(). but 
>>> I did!
>>> (line 44 is while(av_read_frame(..)))
>>>     
>>
>> Could you run this with debug symbols for libavformat?  It's a little
>> difficult to see what's going on without line numbers.
>>
>>   
> of course.
>
> ==11283== 36,082 bytes in 31 blocks are definitely lost in loss record 
> 6 of 7
> ==11283==    at 0x401CA6B: memalign (vg_replace_malloc.c:332)
> ==11283==    by 0x40EADCE: av_malloc (mem.c:62)
> ==11283==    by 0x403FD95: av_new_packet (utils.c:197)
> ==11283==    by 0x4090E97: rtp_parse_packet (rtp.c:457)
> ==11283==    by 0x408EFA9: rtsp_read_packet (rtsp.c:1138)
> ==11283==    by 0x4040D0A: av_read_frame_internal (utils.c:630)
> ==11283==    by 0x403DB66: av_find_stream_info (utils.c:1913)
> ==11283==    by 0x8048855: main (avcodec_sample.0.4.9.cpp:20)
> ==11283==
> ==11283==
> ==11283== 83,637 bytes in 73 blocks are definitely lost in loss record 
> 7 of 7
> ==11283==    at 0x401CA6B: memalign (vg_replace_malloc.c:332)
> ==11283==    by 0x40EADCE: av_malloc (mem.c:62)
> ==11283==    by 0x403FD95: av_new_packet (utils.c:197)
> ==11283==    by 0x4090E97: rtp_parse_packet (rtp.c:457)
> ==11283==    by 0x408EFA9: rtsp_read_packet (rtsp.c:1138)
> ==11283==    by 0x4040D0A: av_read_frame_internal (utils.c:630)
> ==11283==    by 0x804894D: main (avcodec_sample.0.4.9.cpp:44)
> ==11283==
> ==11283== LEAK SUMMARY:
> ==11283==    definitely lost: 129,950 bytes in 211 blocks.
> ==11283==      possibly lost: 0 bytes in 0 blocks.
> ==11283==    still reachable: 18 bytes in 1 blocks.
> ==11283==         suppressed: 0 bytes in 0 blocks.
>
> if this helps..
>
> I do not understand how could possibly there be a memleak,
> it feels like I didnt free something up..
any followups on this, guys?

I've experimented a bit, and it seems av_free_packet is not working properly
on streams.. it works fine with local videos, but it does nothing (or 
pretty much leaves a
leak) when dealing with sdps.

Thanks in advance,

Zoltan NAGY,
Software Engineer





More information about the ffmpeg-devel mailing list