[FFmpeg-trac] #2887(avcodec:new): h264: memleak with threads > 1

FFmpeg trac at avcodec.org
Thu Aug 22 17:38:25 CEST 2013


#2887: h264: memleak with threads > 1
--------------------------------------+-----------------------------------
               Reporter:  cehoyos     |                  Owner:
                   Type:  defect      |                 Status:  new
               Priority:  normal      |              Component:  avcodec
                Version:  git-master  |               Keywords:  h264 leak
             Blocked By:              |               Blocking:
Reproduced by developer:  0           |  Analyzed by developer:  0
--------------------------------------+-----------------------------------
 As originally reported in ticket #1900, no leak with -threads 1.
 {{{
 $ valgrind --leak-check=full ./ffmpeg_g -threads 2 -i h264.avi -f null -
 ==10344== Memcheck, a memory error detector
 ==10344== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
 ==10344== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
 info
 ==10344== Command: ./ffmpeg_g -threads 2 -i h264.avi -f null -
 ==10344==
 ffmpeg version N-55720-gb1e276f Copyright (c) 2000-2013 the FFmpeg
 developers
   built on Aug 22 2013 17:34:44 with gcc 4.7 (SUSE Linux)
   configuration: --enable-gpl --disable-indev=jack
   libavutil      52. 42.100 / 52. 42.100
   libavcodec     55. 29.100 / 55. 29.100
   libavformat    55. 14.102 / 55. 14.102
   libavdevice    55.  3.100 / 55.  3.100
   libavfilter     3. 82.102 /  3. 82.102
   libswscale      2.  5.100 /  2.  5.100
   libswresample   0. 17.103 /  0. 17.103
   libpostproc    52.  3.100 / 52.  3.100
 [h264 @ 0x7248580] missing picture in access unit with size 1941
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 2377
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 2090
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 2305
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 3280
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 2963
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] missing picture in access unit with size 2624
 [h264 @ 0x7248580] no frame!
 [h264 @ 0x7248580] log2_max_frame_num_minus4 out of range (0-12): 46
 [h264 @ 0x7248580] missing picture in access unit with size 2937

 ...

 [h264 @ 0x8437ba0] reference picture missing during reorder
 [h264 @ 0x8437ba0] reference count overflow
 [h264 @ 0x8437ba0] decode_slice_header error
 [h264 @ 0x7248580] missing picture in access unit with size 1722
 [h264 @ 0x773f6e0] reference overflow 4294967295 > 31 or 0 > 31
 [h264 @ 0x773f6e0] decode_slice_header error
 [h264 @ 0x8437ba0] number of reference frames (0+2) exceeds max (1;
 probably corrupt input), discarding one
 [h264 @ 0x773f6e0] Missing reference picture, default is 22
     Last message repeated 4 times
 [h264 @ 0x773f6e0] QP 115820 out of range
 [h264 @ 0x773f6e0] decode_slice_header error
 [h264 @ 0x8437ba0] Reinit context to 16x64, pix_fmt: 0
 [h264 @ 0x8437ba0] Missing reference picture, default is 0
 [h264 @ 0x8437ba0] decode_slice_header error
 frame=  121 fps=6.5 q=0.0 Lsize=N/A time=00:00:05.04 bitrate=N/A dup=119
 drop=0
 video:11kB audio:0kB subtitle:0 global headers:0kB muxing overhead
 -100.189394%
 ==10344==
 ==10344== HEAP SUMMARY:
 ==10344==     in use at exit: 7,813,977 bytes in 28 blocks
 ==10344==   total heap usage: 19,884 allocs, 19,856 frees, 2,053,846,908
 bytes allocated
 ==10344==
 ==10344== 557,480 (278,895 direct, 278,585 indirect) bytes in 1 blocks are
 definitely lost in loss record 2 of 3
 ==10344==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==10344==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==10344==    by 0xC15691: av_mallocz (mem.c:93)
 ==10344==    by 0x9D284B: av_fast_padded_malloc (utils.c:92)
 ==10344==    by 0x71088F: ff_h264_decode_nal (h264.c:669)
 ==10344==    by 0x716495: decode_nal_units.constprop.26 (h264.c:4694)
 ==10344==    by 0x717408: ff_h264_decode_extradata (h264.c:1544)
 ==10344==    by 0x421723: ff_h264_decode_init (h264.c:1619)
 ==10344==    by 0x92EF3A: ff_thread_init (pthread.c:848)
 ==10344==    by 0x9D980E: avcodec_open2 (utils.c:1222)
 ==10344==    by 0x471E5F: transcode_init (ffmpeg.c:1983)
 ==10344==    by 0x45CE26: main (ffmpeg.c:3204)
 ==10344==
 ==10344== 7,256,497 bytes in 26 blocks are definitely lost in loss record
 3 of 3
 ==10344==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==10344==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==10344==    by 0xC15691: av_mallocz (mem.c:93)
 ==10344==    by 0x9D284B: av_fast_padded_malloc (utils.c:92)
 ==10344==    by 0x71088F: ff_h264_decode_nal (h264.c:669)
 ==10344==    by 0x717AF8: decode_frame (h264.c:4694)
 ==10344==    by 0x92D0E5: frame_worker_thread (pthread.c:339)
 ==10344==    by 0x5D1AE0D: start_thread (in /lib64/libpthread-2.15.so)
 ==10344==
 ==10344== LEAK SUMMARY:
 ==10344==    definitely lost: 7,535,392 bytes in 27 blocks
 ==10344==    indirectly lost: 278,585 bytes in 1 blocks
 ==10344==      possibly lost: 0 bytes in 0 blocks
 ==10344==    still reachable: 0 bytes in 0 blocks
 ==10344==         suppressed: 0 bytes in 0 blocks
 ==10344==
 ==10344== For counts of detected and suppressed errors, rerun with: -v
 ==10344== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 2 from 2)
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2887>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list