[FFmpeg-trac] #6212(undetermined:new): Memory leak on Ubuntu 16.04

FFmpeg trac at avcodec.org
Thu Mar 2 20:04:52 EET 2017


#6212: Memory leak on Ubuntu 16.04
-------------------------------------+-------------------------------------
             Reporter:  alqemyst     |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:  leak         |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by alqemyst):

 Sure. This is ffmpeg version:

 {{{
 ./ffmpeg -version
 ffmpeg version N-83708-g4bed066 Copyright (c) 2000-2017 the FFmpeg
 developers
 built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
 configuration: --prefix=/opt/siqnal --enable-gpl --enable-nonfree
 --enable-version3 --enable-libx264 --enable-libfdk_aac --enable-libmp3lame
 --enable-openssl --enable-libfreetype --enable-fontconfig --enable-vaapi
 --enable-nvenc --enable-cuda --enable-cuvid --enable-libnpp --disable-
 ffplay --disable-doc --disable-ffserver
 libavutil      55. 47.100 / 55. 47.100
 libavcodec     57. 81.101 / 57. 81.101
 libavformat    57. 66.102 / 57. 66.102
 libavdevice    57.  3.100 / 57.  3.100
 libavfilter     6. 74.100 /  6. 74.100
 libswscale      4.  3.101 /  4.  3.101
 libswresample   2.  4.100 /  2.  4.100
 libpostproc    54.  2.100 / 54.  2.100
 }}}

 NVENC command:

 {{{
 valgrind ./ffmpeg_g -y -loglevel error -hwaccel cuvid -c:v mpeg2_cuvid
 -deint 2 -i
 "udp://239.250.14.12:5004?fifo_size=1000000&overrun_nonfatal=1"
 -ignore_unknown -sn -an -c:v nvenc_h264 -profile:v high -b:v 2000k
 -maxrate:v 1M -bufsize:v 500k -r 25 -g 50 -aspect 16:9 -vf
 scale_npp=640:360 -f hls -hls_time 6 -hls_list_size 6 -use_localtime 1
 -hls_segment_filename "hls/0-%s.ts" "hls/0.m3u8"
 ==21588== Memcheck, a memory error detector
 ==21588== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
 ==21588== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
 info
 ==21588== Command: ./ffmpeg_g -y -loglevel error -hwaccel cuvid -c:v
 mpeg2_cuvid -deint 2 -i
 udp://239.250.14.12:5004?fifo_size=1000000&overrun_nonfatal=1
 -ignore_unknown -sn -an -c:v nvenc_h264 -profile:v high -b:v 2000k
 -maxrate:v 1M -bufsize:v 500k -r 25 -g 50 -aspect 16:9 -vf
 scale_npp=640:360 -f hls -hls_time 6 -hls_list_size 6 -use_localtime 1
 -hls_segment_filename hls/0-%s.ts hls/0.m3u8
 ==21588==
 [mpeg2video @ 0xc4f7040] Invalid frame dimensions 0x0.
 ==21588== Warning: noted but unhandled ioctl 0x30000001 with no
 size/direction hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x27 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x7ff with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x25 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x17 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: set address range perms: large range [0x200000000,
 0x700000000) (noaccess)
 ==21588== Warning: set address range perms: large range [0x900000000,
 0xc00000000) (noaccess)
 ==21588== Warning: noted but unhandled ioctl 0x19 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x21 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x1b with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Conditional jump or move depends on uninitialised value(s)
 ==21588==    at 0x1C7E078F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F44BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F26BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E14A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E91D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E6ECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E4BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x4235DC: cuvid_test_dummy_decoder (cuvid.c:670)
 ==21588==    by 0x4235DC: cuvid_decode_init (cuvid.c:855)
 ==21588==    by 0xAF71A9: avcodec_open2 (utils.c:1609)
 ==21588==    by 0x49CA47: init_input_stream (ffmpeg.c:2758)
 ==21588==    by 0x49CA47: transcode_init (ffmpeg.c:3478)
 ==21588==    by 0x4A2C28: transcode (ffmpeg.c:4364)
 ==21588==    by 0x483823: main (ffmpeg.c:4598)
 ==21588==
 ==21588== Conditional jump or move depends on uninitialised value(s)
 ==21588==    at 0x1C7E079F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F44BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F26BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E14A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E91D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E6ECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E4BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x4235DC: cuvid_test_dummy_decoder (cuvid.c:670)
 ==21588==    by 0x4235DC: cuvid_decode_init (cuvid.c:855)
 ==21588==    by 0xAF71A9: avcodec_open2 (utils.c:1609)
 ==21588==    by 0x49CA47: init_input_stream (ffmpeg.c:2758)
 ==21588==    by 0x49CA47: transcode_init (ffmpeg.c:3478)
 ==21588==    by 0x4A2C28: transcode (ffmpeg.c:4364)
 ==21588==    by 0x483823: main (ffmpeg.c:4598)
 ==21588==
 ==21588== Conditional jump or move depends on uninitialised value(s)
 ==21588==    at 0x1C7E07AF: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F44BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F26BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E14A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E91D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E6ECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E4BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x4235DC: cuvid_test_dummy_decoder (cuvid.c:670)
 ==21588==    by 0x4235DC: cuvid_decode_init (cuvid.c:855)
 ==21588==    by 0xAF71A9: avcodec_open2 (utils.c:1609)
 ==21588==    by 0x49CA47: init_input_stream (ffmpeg.c:2758)
 ==21588==    by 0x49CA47: transcode_init (ffmpeg.c:3478)
 ==21588==    by 0x4A2C28: transcode (ffmpeg.c:4364)
 ==21588==    by 0x483823: main (ffmpeg.c:4598)
 ==21588==
 ==21588== Warning: noted but unhandled ioctl 0x42 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Warning: noted but unhandled ioctl 0x22 with no size/direction
 hints.
 ==21588==    This could cause spurious value errors to appear.
 ==21588==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==21588== Conditional jump or move depends on uninitialised value(s)
 ==21588==    at 0x1C7E0CED: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F077F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E8D4A: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x79B0C3: cuvid_handle_picture_decode (cuvid.c:300)
 ==21588==    by 0x1C7DEE47: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C845598: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C845FAB: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7DE970: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x79B322: cuvid_decode_packet (cuvid.c:393)
 ==21588==    by 0xAF2FCA: avcodec_send_packet (utils.c:2866)
 ==21588==    by 0x4A1CE2: decode (ffmpeg.c:2052)
 ==21588==    by 0x4A1CE2: decode_video (ffmpeg.c:2248)
 ==21588==    by 0x4A38E5: process_input_packet (ffmpeg.c:2491)
 ==21588==    by 0x4A38E5: process_input (ffmpeg.c:4251)
 ==21588==    by 0x4A38E5: transcode_step (ffmpeg.c:4339)
 ==21588==    by 0x4A38E5: transcode (ffmpeg.c:4393)
 ==21588==
 ==21588== Conditional jump or move depends on uninitialised value(s)
 ==21588==    at 0x1C7E0D15: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7F077F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7E8D4A: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x79B0C3: cuvid_handle_picture_decode (cuvid.c:300)
 ==21588==    by 0x1C7DEE47: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C845598: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C845FAB: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x1C7DE970: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==21588==    by 0x79B322: cuvid_decode_packet (cuvid.c:393)
 ==21588==    by 0xAF2FCA: avcodec_send_packet (utils.c:2866)
 ==21588==    by 0x4A1CE2: decode (ffmpeg.c:2052)
 ==21588==    by 0x4A1CE2: decode_video (ffmpeg.c:2248)
 ==21588==    by 0x4A38E5: process_input_packet (ffmpeg.c:2491)
 ==21588==    by 0x4A38E5: process_input (ffmpeg.c:4251)
 ==21588==    by 0x4A38E5: transcode_step (ffmpeg.c:4339)
 ==21588==    by 0x4A38E5: transcode (ffmpeg.c:4393)
 ==21588==
     Last message repeated 10 times
 ==21588==
 ==21588== HEAP SUMMARY:
 ==21588==     in use at exit: 187,676,954 bytes in 240,734 blocks
 ==21588==   total heap usage: 1,101,312 allocs, 860,578 frees,
 3,892,090,398 bytes allocated
 ==21588==
 ==21588== LEAK SUMMARY:
 ==21588==    definitely lost: 26,108 bytes in 200 blocks
 ==21588==    indirectly lost: 2,868,060 bytes in 579 blocks
 ==21588==      possibly lost: 54,614,106 bytes in 28,034 blocks
 ==21588==    still reachable: 130,168,680 bytes in 211,921 blocks
 ==21588==         suppressed: 0 bytes in 0 blocks
 ==21588== Rerun with --leak-check=full to see details of leaked memory
 ==21588==
 ==21588== For counts of detected and suppressed errors, rerun with: -v
 ==21588== Use --track-origins=yes to see where uninitialised values come
 from
 ==21588== ERROR SUMMARY: 127 errors from 5 contexts (suppressed: 0 from 0)
 }}}

 VAAPI command:

 {{{
 valgrind ./ffmpeg_g -y -loglevel error -vaapi_device /dev/dri/renderD128
 -hwaccel vaapi -hwaccel_output_format vaapi -i
 "udp://239.250.14.12:5004?fifo_size=1000000&overrun_nonfatal=1"
 -ignore_unknown -sn -an -c:v h264_vaapi -b:v 1M -maxrate:v 1M -bufsize:v
 500k -r 25 -g 50 -aspect 16:9 -vf
 "format=nv12|vaapi,hwupload,deinterlace_vaapi,scale_vaapi=w=640:h=360" -f
 hls -hls_time 6 -hls_list_size 6 -use_localtime 1 -hls_segment_filename
 "hls/1-%s.ts" "hls/1.m3u8"
 ==21586== Memcheck, a memory error detector
 ==21586== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
 ==21586== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
 info
 ==21586== Command: ./ffmpeg_g -y -loglevel error -vaapi_device
 /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i
 udp://239.250.14.12:5004?fifo_size=1000000&overrun_nonfatal=1
 -ignore_unknown -sn -an -c:v h264_vaapi -b:v 1M -maxrate:v 1M -bufsize:v
 500k -r 25 -g 50 -aspect 16:9 -vf
 format=nv12|vaapi,hwupload,deinterlace_vaapi,scale_vaapi=w=640:h=360 -f
 hls -hls_time 6 -hls_list_size 6 -use_localtime 1 -hls_segment_filename
 hls/1-%s.ts hls/1.m3u8
 ==21586==
 libva info: VA-API version 0.39.0
 libva info: va_getDriverName() returns 0
 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
 libva info: Found init function __vaDriverInit_0_39
 libva info: va_openDriver() returns 0
 [mpeg2video @ 0xc504860] Invalid frame dimensions 0x0.
     Last message repeated 3 times
 ==21586==
 ==21586== HEAP SUMMARY:
 ==21586==     in use at exit: 12,940,216 bytes in 3,919 blocks
 ==21586==   total heap usage: 3,916,874 allocs, 3,912,955 frees,
 265,677,253,039 bytes allocated
 ==21586==
 ==21586== LEAK SUMMARY:
 ==21586==    definitely lost: 9,714,600 bytes in 290 blocks
 ==21586==    indirectly lost: 3,014,596 bytes in 626 blocks
 ==21586==      possibly lost: 48,648 bytes in 166 blocks
 ==21586==    still reachable: 162,372 bytes in 2,837 blocks
 ==21586==         suppressed: 0 bytes in 0 blocks
 ==21586== Rerun with --leak-check=full to see details of leaked memory
 ==21586==
 ==21586== For counts of detected and suppressed errors, rerun with: -v
 ==21586== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 }}}

 After 10 minutes NVENC was using 800 MB and VAAPI 400 MB, but usage was
 rising when I stopped it.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/6212#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list