[Ffmpeg-devel] possible memory leak?
Zoltan NAGY
nagyz
Sun Jan 22 20:00:30 CET 2006
Hello!
I've been using ffmpeg to play various streams, and I found out that my
apps leak memory.
the stream parameters:
Input #0, sdp, from '/opt/mmsys/videos/2038_capture.sdp':
Duration: N/A, bitrate: N/A
Stream #0.0: Video: mpeg4, yuv420p, 320x240, 25.00 fps
Stream #0.1: Audio: 0x0000
So I've cooked up a little sample application (basically using Martin
Bohme's example),
and ran it thru valgrind.
the app basically does this:
while(av_read_frame(pFormatCtx, &packet)>=0)
{
av_free_packet(&packet);
if( SDL_GetTicks() - kezdet > 5000 )
{
printf( "time's up!\n" );
break;
}
}
so it quits after 5 secs, and it should free all packets. yet, valgrind
sais:
==24793== LEAK SUMMARY:
==24793== definitely lost: 126,350 bytes in 208 blocks.
==24793== indirectly lost: 1,121 bytes in 1 blocks.
==24793== possibly lost: 2,293 bytes in 2 blocks.
==24793== still reachable: 18 bytes in 1 blocks.
==24793== suppressed: 0 bytes in 0 blocks.
and the relevant info:
==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(..)))
any ideas?
I dont understand this, as I always free it.
the source can be found at: http://nefty.hu/~nagyz/ffmpeg.c
I'd really appreciate any help.
Thanks,
Zoltan NAGY,
Software Engineer
More information about the ffmpeg-devel
mailing list