Opened 9 years ago
Closed 9 years ago
#5004 closed defect (duplicate)
ffmpeg leaks memory decoding mpeg2video/encoding mpeg1video
Reported by: | c-14 | Owned by: | |
---|---|---|---|
Priority: | important | Component: | avcodec |
Version: | git-master | Keywords: | leak regression |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | yes | |
Analyzed by developer: | no |
Description
Summary of the bug:
When decoding raw mpeg2video and encoding to raw mpeg1video, ffmpeg leaks memory.
Note: I have been unable to reproduce with non-mpeg2video input (eg using -f lavfi -i testsrc directly in the command encoding to mpeg1video does not cause the leaks)
How to reproduce:
ffbuild/source/ffmpeg/ffmpeg_g -hide_banner -loglevel quiet -f lavfi -i testsrc -c:v mpeg2video -t 120 -f mpeg2video pipe:1 | valgrind --leak-check=yes ffbuild/source/ffmpeg/ffmpeg_g -f mpegvideo -threads 1 -i - -f mpeg1video -an -threads 1 - > /dev/null ==6798== Memcheck, a memory error detector ==6798== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al. ==6798== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info ==6798== Command: ffbuild/source/ffmpeg/ffmpeg_g -f mpegvideo -threads 1 -i - -f mpeg1video -an -threads 1 - ==6798== ffmpeg version N-76639-g58d32c0 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.3 (Gentoo 4.9.3 p1.0, pie-0.6.2) configuration: --prefix=/home/radiocarbon/ffbuild --extra-libs=-lstdc++ --enable-fontconfig --enable-libzimg --enable-gpl --enable-libass --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 libavutil 55. 5.100 / 55. 5.100 libavcodec 57. 15.100 / 57. 15.100 libavformat 57. 14.100 / 57. 14.100 libavdevice 57. 0.100 / 57. 0.100 libavfilter 6. 15.100 / 6. 15.100 libswscale 4. 0.100 / 4. 0.100 libswresample 2. 0.101 / 2. 0.101 libpostproc 54. 0.100 / 54. 0.100 Input #0, mpegvideo, from 'pipe:': Duration: N/A, bitrate: N/A Stream #0:0: Video: mpeg2video (Main), yuv420p(tv), 320x240 [SAR 1:1 DAR 4:3], max. 104857 kb/s, 25 fps, 25 tbr, 1200k tbn, 50 tbc Output #0, mpeg1video, to 'pipe:': Metadata: encoder : Lavf57.14.100 Stream #0:0: Video: mpeg1video, yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc Metadata: encoder : Lavc57.15.100 mpeg1video Stream mapping: Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg1video (native)) frame= 3000 fps= 67 q=7.2 Lsize= 3214kB time=00:02:00.00 bitrate= 219.4kbits/s video:3214kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000% ==6798== ==6798== HEAP SUMMARY: ==6798== in use at exit: 1,265,196 bytes in 8,995 blocks ==6798== total heap usage: 482,338 allocs, 473,343 frees, 32,619,710 bytes allocated ==6798== ==6798== 358 bytes in 1 blocks are possibly lost in loss record 3 of 7 ==6798== at 0x4C2C576: memalign (vg_replace_malloc.c:858) ==6798== by 0x4C2C691: posix_memalign (vg_replace_malloc.c:1021) ==6798== by 0xEBA04F: av_malloc (mem.c:97) ==6798== by 0xEAA913: av_buffer_alloc (buffer.c:71) ==6798== by 0xEAA913: av_buffer_make_writable (buffer.c:157) ==6798== by 0x94E487: make_tables_writable (mpegpicture.c:45) ==6798== by 0x94E487: ff_alloc_picture (mpegpicture.c:259) ==6798== by 0x954DB3: alloc_picture (mpegvideo.c:350) ==6798== by 0x954DB3: ff_mpv_frame_start (mpegvideo.c:1246) ==6798== by 0x91C57A: mpeg_field_start (mpeg12dec.c:1674) ==6798== by 0x922CCB: decode_chunks (mpeg12dec.c:2716) ==6798== by 0x92341E: mpeg_decode_frame (mpeg12dec.c:2832) ==6798== by 0xA78667: avcodec_decode_video2 (utils.c:2103) ==6798== by 0x494591: decode_video (ffmpeg.c:2092) ==6798== by 0x498C4F: process_input_packet (ffmpeg.c:2341) ==6798== ==6798== 1,264,798 (71,952 direct, 1,192,846 indirect) bytes in 2,998 blocks are definitely lost in loss record 7 of 7 ==6798== at 0x4C2C576: memalign (vg_replace_malloc.c:858) ==6798== by 0x4C2C691: posix_memalign (vg_replace_malloc.c:1021) ==6798== by 0xEBA35B: av_malloc (mem.c:97) ==6798== by 0xEBA35B: av_mallocz (mem.c:254) ==6798== by 0xEAA7FD: av_buffer_ref (buffer.c:94) ==6798== by 0xEB3394: frame_copy_props.constprop.4 (frame.c:361) ==6798== by 0x95F66A: frame_end (mpegvideo_enc.c:1660) ==6798== by 0x95F66A: ff_mpv_encode_picture (mpegvideo_enc.c:1832) ==6798== by 0xA78133: avcodec_encode_video2 (utils.c:1858) ==6798== by 0x496841: do_video_out (ffmpeg.c:1196) ==6798== by 0x49BE80: reap_filters (ffmpeg.c:1387) ==6798== by 0x47D20A: transcode_step (ffmpeg.c:4059) ==6798== by 0x47D20A: transcode (ffmpeg.c:4103) ==6798== by 0x47D20A: main (ffmpeg.c:4296) ==6798== ==6798== LEAK SUMMARY: ==6798== definitely lost: 71,952 bytes in 2,998 blocks ==6798== indirectly lost: 1,192,846 bytes in 5,995 blocks ==6798== possibly lost: 358 bytes in 1 blocks ==6798== still reachable: 40 bytes in 1 blocks ==6798== suppressed: 0 bytes in 0 blocks ==6798== Reachable blocks (those to which a pointer was found) are not shown. ==6798== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==6798== ==6798== For counts of detected and suppressed errors, rerun with: -v ==6798== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
Change History (2)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Component: | undetermined → avcodec |
---|---|
Keywords: | leak regression added |
Priority: | normal → important |
Reproduced by developer: | set |
Resolution: | → duplicate |
Status: | new → closed |
Regression since b1fad7ac200d0779a44fc267085d7d46ce2391b9 - duplicate of ticket #4899
Note:
See TracTickets
for help on using tickets.
Workaround is to pipe through raw video: