[FFmpeg-trac] #1900(avcodec:open): h264: huge memory allocation and a memleak

FFmpeg trac at avcodec.org
Sun Dec 23 12:00:23 CET 2012


#1900: h264: huge memory allocation and a memleak
------------------------------------+-----------------------------------
             Reporter:  ami_stuff   |                    Owner:
                 Type:  defect      |                   Status:  open
             Priority:  important   |                Component:  avcodec
              Version:  git-master  |               Resolution:
             Keywords:  h264 leak   |               Blocked By:
             Blocking:              |  Reproduced by developer:  1
Analyzed by developer:  0           |
------------------------------------+-----------------------------------

Comment (by cehoyos):

 No memory leak with -threads 1. (Memory allocation varies, the following
 run was stopped early.)
 {{{
 $ valgrind --leak-check=full ffmpeg_g -threads 2 -i h264.avi -f null -
 ==20435== Memcheck, a memory error detector
 ==20435== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
 ==20435== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
 info
 ==20435== Command: ffmpeg_g -i h264.avi -f null -
 ==20435==
 ffmpeg version N-48119-gf9d8658 Copyright (c) 2000-2012 the FFmpeg
 developers
   built on Dec 23 2012 11:31:11 with gcc 4.7 (SUSE Linux)
   configuration: --enable-gpl --disable-indev=jack --disable-yasm
 --disable-asm --disable-optimizations
   libavutil      52. 12.100 / 52. 12.100
   libavcodec     54. 81.100 / 54. 81.100
   libavformat    54. 49.102 / 54. 49.102
   libavdevice    54.  3.102 / 54.  3.102
   libavfilter     3. 29.101 /  3. 29.101
   libswscale      2.  1.103 /  2.  1.103
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100

 [...]

 ==20435== HEAP SUMMARY:
 ==20435==     in use at exit: 7,813,977 bytes in 28 blocks
 ==20435==   total heap usage: 2,207 allocs, 2,179 frees, 1,948,151,926
 bytes allocated
 ==20435==
 ==20435== 278,895 bytes in 1 blocks are definitely lost in loss record 1
 of 2
 ==20435==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==20435==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==20435==    by 0xC9E701: av_malloc (mem.c:92)
 ==20435==    by 0xC9E861: av_mallocz (mem.c:198)
 ==20435==    by 0xA3E900: ff_fast_malloc (utils.c:82)
 ==20435==    by 0xA3E9C3: av_fast_padded_malloc (utils.c:102)
 ==20435==    by 0x71B5F3: ff_h264_decode_nal (h264.c:240)
 ==20435==    by 0x777EDC: decode_nal_units (h264.c:3983)
 ==20435==    by 0x71D71B: ff_h264_decode_extradata (h264.c:1056)
 ==20435==    by 0x71D94E: ff_h264_decode_init (h264.c:1108)
 ==20435==    by 0x986FB4: frame_thread_init (pthread.c:860)
 ==20435==    by 0x98794F: ff_thread_init (pthread.c:1090)
 ==20435==
 ==20435== 7,535,082 bytes in 27 blocks are definitely lost in loss record
 2 of 2
 ==20435==    at 0x4C290FE: memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==20435==    by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==20435==    by 0xC9E701: av_malloc (mem.c:92)
 ==20435==    by 0xC9E861: av_mallocz (mem.c:198)
 ==20435==    by 0xA3E900: ff_fast_malloc (utils.c:82)
 ==20435==    by 0xA3E9C3: av_fast_padded_malloc (utils.c:102)
 ==20435==    by 0x71B5F3: ff_h264_decode_nal (h264.c:240)
 ==20435==    by 0x777EDC: decode_nal_units (h264.c:3983)
 ==20435==    by 0x779067: decode_frame (h264.c:4332)
 ==20435==    by 0x985A9C: frame_worker_thread (pthread.c:388)
 ==20435==    by 0x55C6E0D: start_thread (in /lib64/libpthread-2.15.so)
 ==20435==
 ==20435== LEAK SUMMARY:
 ==20435==    definitely lost: 7,813,977 bytes in 28 blocks
 ==20435==    indirectly lost: 0 bytes in 0 blocks
 ==20435==      possibly lost: 0 bytes in 0 blocks
 ==20435==    still reachable: 0 bytes in 0 blocks
 ==20435==         suppressed: 0 bytes in 0 blocks
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1900#comment:9>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list