[FFmpeg-trac] #5799(undetermined:new): Memory psudo-leak when FF_API_CODED_FRAME enabled
FFmpeg
trac at avcodec.org
Fri Aug 26 01:37:43 EEST 2016
#5799: Memory psudo-leak when FF_API_CODED_FRAME enabled
-------------------------------------+-------------------------------------
Reporter: DeHackEd | Type: defect
Status: new | Priority: normal
Component: | Version: git-
undetermined | master
Keywords: coded_frame | Blocked By:
leak | Reproduced by developer: 0
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Summary of the bug:
How to reproduce:
{{{
% ffmpeg -i verylargefile.ts -c:v mpeg2video -c:a ac3 -b:a 384k -muxrate
4.50M -b:v 3.75M -maxrate:v 3.75M -minrate:v 1.00M -bufsize:v 1000k -flags
ildct -vf interlace -s 640:480 -f mpegts -map 0:0 -map 0:1
udp://239.255.255.1:1234
}}}
Git version 500662784341373d625af629cad94826beca3bc8 tested
Valgrind reports the following stack trace consuming memory for each
frame:
{{{
==19806== 195,744 bytes in 8,156 blocks are still reachable in loss record
694 of 731
==19806== at 0x4A05588: memalign (vg_replace_malloc.c:727)
==19806== by 0x4A05623: posix_memalign (vg_replace_malloc.c:876)
==19806== by 0xC98A99: av_mallocz (mem.c:97)
==19806== by 0xC8A2F9: av_buffer_alloc (buffer.c:48)
==19806== by 0xC92195: frame_copy_props (frame.c:636)
==19806== by 0x6A2E04: ff_mpv_encode_picture (mpegvideo_enc.c:1738)
==19806== by 0x7178EE: avcodec_encode_video2 (utils.c:1961)
==19806== by 0x459049: do_video_out (ffmpeg.c:1176)
==19806== by 0x459FA0: reap_filters (ffmpeg.c:1367)
==19806== by 0x45E59B: main (ffmpeg.c:4114)
}}}
The memory allocation will be cleaned up eventually on shutdown --
valgrind will not report a true memory leak -- but while ffmpeg is running
memory usage will grow over time. Very long runs (well over 24 hours) will
consume gigabytes of RAM.
Editing libavcodec/version.h to force FF_API_CODED_FRAME to 0 appears to
fix the issue.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5799>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list