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

FFmpeg trac at avcodec.org
Fri Nov 16 01:08:04 CET 2012


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

Comment (by cehoyos):

 I get the following with "ulimit -Sv 1200000", not reproducible with
 -threads 1:
 {{{
 $ valgrind ffmpeg_g -i h264.avi -f null -

 [...]

 Output file is empty, nothing was encoded (check -ss / -t / -frames
 parameters if used)
 ==26146== Invalid free() / delete / delete[] / realloc()
 ==26146==    at 0x4C29D4E: free (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==26146==    by 0xBAB4EB: av_freep (mem.c:190)
 ==26146==    by 0x8962CA: ff_MPV_common_end (mpegvideo.c:471)
 ==26146==    by 0x41EA4D: h264_decode_end (h264.c:4176)
 ==26146==    by 0x8E2754: frame_thread_free (pthread.c:771)
 ==26146==    by 0x4348B1: avcodec_close (utils.c:1963)
 ==26146==    by 0x453939: main (ffmpeg.c:3025)
 ==26146==  Address 0x3ade9080 is not stack'd, malloc'd or (recently)
 free'd
 ==26146==
 ==26146== Invalid free() / delete / delete[] / realloc()
 ==26146==    at 0x4C29D4E: free (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==26146==    by 0xBAB4EB: av_freep (mem.c:190)
 ==26146==    by 0x8962D6: ff_MPV_common_end (mpegvideo.c:472)
 ==26146==    by 0x41EA4D: h264_decode_end (h264.c:4176)
 ==26146==    by 0x8E2754: frame_thread_free (pthread.c:771)
 ==26146==    by 0x4348B1: avcodec_close (utils.c:1963)
 ==26146==    by 0x453939: main (ffmpeg.c:3025)
 ==26146==  Address 0x3b1e9080 is 0 bytes inside a block of size 297,262
 free'd
 ==26146==    at 0x4C29D4E: free (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==26146==    by 0xBAB4EB: av_freep (mem.c:190)
 ==26146==    by 0x8962D6: ff_MPV_common_end (mpegvideo.c:472)
 ==26146==    by 0x4282F6: ff_MPV_common_init (mpegvideo.c:914)
 ==26146==    by 0x896C13: ff_mpeg_update_thread_context (mpegvideo.c:551)
 ==26146==    by 0x772A99: decode_update_thread_context (h264.c:1179)
 ==26146==    by 0x8E2D1C: ff_thread_decode_frame (pthread.c:458)
 ==26146==    by 0x98ABD3: avcodec_decode_video2 (utils.c:1663)
 ==26146==    by 0x45FCB4: decode_video (ffmpeg.c:1563)
 ==26146==    by 0x453EEC: main (ffmpeg.c:1764)
 ==26146==
 ==26146== Invalid free() / delete / delete[] / realloc()
 ==26146==    at 0x4C29D4E: free (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==26146==    by 0xBAB4EB: av_freep (mem.c:190)
 ==26146==    by 0x896332: ff_MPV_common_end (mpegvideo.c:481)
 ==26146==    by 0x41EA4D: h264_decode_end (h264.c:4176)
 ==26146==    by 0x8E2754: frame_thread_free (pthread.c:771)
 ==26146==    by 0x4348B1: avcodec_close (utils.c:1963)
 ==26146==    by 0x453939: main (ffmpeg.c:3025)
 ==26146==  Address 0x22e1c8e0 is 0 bytes inside a block of size 2,520
 free'd
 ==26146==    at 0x4C29D4E: free (in /usr/lib64/valgrind
 /vgpreload_memcheck-amd64-linux.so)
 ==26146==    by 0xBAB4EB: av_freep (mem.c:190)
 ==26146==    by 0x896332: ff_MPV_common_end (mpegvideo.c:481)
 ==26146==    by 0x4282F6: ff_MPV_common_init (mpegvideo.c:914)
 ==26146==    by 0x896C13: ff_mpeg_update_thread_context (mpegvideo.c:551)
 ==26146==    by 0x772A99: decode_update_thread_context (h264.c:1179)
 ==26146==    by 0x8E2D1C: ff_thread_decode_frame (pthread.c:458)
 ==26146==    by 0x98ABD3: avcodec_decode_video2 (utils.c:1663)
 ==26146==    by 0x45FCB4: decode_video (ffmpeg.c:1563)
 ==26146==    by 0x453EEC: main (ffmpeg.c:1764)
 ==26146==
 ==26146==
 ==26146== HEAP SUMMARY:
 ==26146==     in use at exit: 7,535,176 bytes in 27 blocks
 ==26146==   total heap usage: 4,035 allocs, 5,053 frees, 2,003,924,921
 bytes allocated
 ==26146==
 ==26146== LEAK SUMMARY:
 ==26146==    definitely lost: 7,256,557 bytes in 26 blocks
 ==26146==    indirectly lost: 0 bytes in 0 blocks
 ==26146==      possibly lost: 278,619 bytes in 1 blocks
 ==26146==    still reachable: 0 bytes in 0 blocks
 ==26146==         suppressed: 0 bytes in 0 blocks
 ==26146== Rerun with --leak-check=full to see details of leaked memory
 ==26146==
 ==26146== For counts of detected and suppressed errors, rerun with: -v
 ==26146== ERROR SUMMARY: 1311 errors from 13 contexts (suppressed: 2 from
 2)
 }}}

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


More information about the FFmpeg-trac mailing list