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

FFmpeg trac at avcodec.org
Thu Mar 2 20:59:12 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):

 Now when I try wihout pthreads I have following:

 {{{
 ./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 --disable-pthreads
 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

 {{{
 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 1M -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"
 ==1753== Memcheck, a memory error detector
 ==1753== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
 ==1753== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
 info
 ==1753== 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 1M -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
 ==1753==
 [mpeg2video @ 0xc4f6d60] Invalid frame dimensions 0x0.
 ==1753== Warning: noted but unhandled ioctl 0x30000001 with no
 size/direction hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x27 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x7ff with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x25 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x17 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: set address range perms: large range [0x200000000,
 0x700000000) (noaccess)
 ==1753== Warning: set address range perms: large range [0x900000000,
 0xc00000000) (noaccess)
 ==1753== Warning: noted but unhandled ioctl 0x19 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x21 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x1b with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Conditional jump or move depends on uninitialised value(s)
 ==1753==    at 0x10C9478F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA84BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA66BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C954A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9D1D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9AECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C98BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x422F8C: cuvid_test_dummy_decoder (cuvid.c:670)
 ==1753==    by 0x422F8C: cuvid_decode_init (cuvid.c:855)
 ==1753==    by 0xAEF898: avcodec_open2 (utils.c:1609)
 ==1753==    by 0x49C007: init_input_stream (ffmpeg.c:2758)
 ==1753==    by 0x49C007: transcode_init (ffmpeg.c:3478)
 ==1753==    by 0x4A21E8: transcode (ffmpeg.c:4364)
 ==1753==    by 0x483073: main (ffmpeg.c:4598)
 ==1753==
 ==1753== Conditional jump or move depends on uninitialised value(s)
 ==1753==    at 0x10C9479F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA84BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA66BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C954A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9D1D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9AECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C98BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x422F8C: cuvid_test_dummy_decoder (cuvid.c:670)
 ==1753==    by 0x422F8C: cuvid_decode_init (cuvid.c:855)
 ==1753==    by 0xAEF898: avcodec_open2 (utils.c:1609)
 ==1753==    by 0x49C007: init_input_stream (ffmpeg.c:2758)
 ==1753==    by 0x49C007: transcode_init (ffmpeg.c:3478)
 ==1753==    by 0x4A21E8: transcode (ffmpeg.c:4364)
 ==1753==    by 0x483073: main (ffmpeg.c:4598)
 ==1753==
 ==1753== Conditional jump or move depends on uninitialised value(s)
 ==1753==    at 0x10C947AF: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA84BC: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA66BE: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C954A1: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9D1D6: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9AECA: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C98BD6: cuvidCreateDecoder (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x422F8C: cuvid_test_dummy_decoder (cuvid.c:670)
 ==1753==    by 0x422F8C: cuvid_decode_init (cuvid.c:855)
 ==1753==    by 0xAEF898: avcodec_open2 (utils.c:1609)
 ==1753==    by 0x49C007: init_input_stream (ffmpeg.c:2758)
 ==1753==    by 0x49C007: transcode_init (ffmpeg.c:3478)
 ==1753==    by 0x4A21E8: transcode (ffmpeg.c:4364)
 ==1753==    by 0x483073: main (ffmpeg.c:4598)
 ==1753==
 ==1753== Warning: noted but unhandled ioctl 0x42 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Warning: noted but unhandled ioctl 0x22 with no size/direction
 hints.
 ==1753==    This could cause spurious value errors to appear.
 ==1753==    See README_MISSING_SYSCALL_OR_IOCTL for guidance on writing a
 proper wrapper.
 ==1753== Conditional jump or move depends on uninitialised value(s)
 ==1753==    at 0x10C94CED: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA477F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9CD4A: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x797A23: cuvid_handle_picture_decode (cuvid.c:300)
 ==1753==    by 0x10C92E47: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CF9598: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CF9FAB: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C92970: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x797C82: cuvid_decode_packet (cuvid.c:393)
 ==1753==    by 0xAEB7DA: avcodec_send_packet (utils.c:2866)
 ==1753==    by 0x4A12A2: decode (ffmpeg.c:2052)
 ==1753==    by 0x4A12A2: decode_video (ffmpeg.c:2248)
 ==1753==    by 0x4A2DD4: process_input_packet (ffmpeg.c:2491)
 ==1753==    by 0x4A2DD4: process_input (ffmpeg.c:4251)
 ==1753==    by 0x4A2DD4: transcode_step (ffmpeg.c:4339)
 ==1753==    by 0x4A2DD4: transcode (ffmpeg.c:4393)
 ==1753==
 ==1753== Conditional jump or move depends on uninitialised value(s)
 ==1753==    at 0x10C94D15: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CA477F: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C9CD4A: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x797A23: cuvid_handle_picture_decode (cuvid.c:300)
 ==1753==    by 0x10C92E47: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CF9598: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10CF9FAB: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x10C92970: ??? (in
 /usr/lib/nvidia-378/libnvcuvid.so.378.13)
 ==1753==    by 0x797C82: cuvid_decode_packet (cuvid.c:393)
 ==1753==    by 0xAEB7DA: avcodec_send_packet (utils.c:2866)
 ==1753==    by 0x4A12A2: decode (ffmpeg.c:2052)
 ==1753==    by 0x4A12A2: decode_video (ffmpeg.c:2248)
 ==1753==    by 0x4A2DD4: process_input_packet (ffmpeg.c:2491)
 ==1753==    by 0x4A2DD4: process_input (ffmpeg.c:4251)
 ==1753==    by 0x4A2DD4: transcode_step (ffmpeg.c:4339)
 ==1753==    by 0x4A2DD4: transcode (ffmpeg.c:4393)
 ==1753==
     Last message repeated 1 times
 ==1753==
 ==1753== HEAP SUMMARY:
 ==1753==     in use at exit: 188,936,314 bytes in 241,022 blocks
 ==1753==   total heap usage: 1,416,881 allocs, 1,175,859 frees,
 5,150,659,127 bytes allocated
 ==1753==
 ==1753== LEAK SUMMARY:
 ==1753==    definitely lost: 33,820 bytes in 261 blocks
 ==1753==    indirectly lost: 4,087,020 bytes in 807 blocks
 ==1753==      possibly lost: 54,646,874 bytes in 28,035 blocks
 ==1753==    still reachable: 130,168,600 bytes in 211,919 blocks
 ==1753==         suppressed: 0 bytes in 0 blocks
 ==1753== Rerun with --leak-check=full to see details of leaked memory
 ==1753==
 ==1753== For counts of detected and suppressed errors, rerun with: -v
 ==1753== Use --track-origins=yes to see where uninitialised values come
 from
 ==1753== ERROR SUMMARY: 127 errors from 5 contexts (suppressed: 0 from 0)
 }}}

 VAAPI

 {{{
 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"
 ==1752== Memcheck, a memory error detector
 ==1752== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
 ==1752== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright
 info
 ==1752== 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
 ==1752==
 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 @ 0xc504580] Invalid frame dimensions 0x0.
 Unrepairable overflow!ted 10 times
     Last message repeated 10 times
 ==1752==
 ==1752== HEAP SUMMARY:
 ==1752==     in use at exit: 14,172,856 bytes in 4,230 blocks
 ==1752==   total heap usage: 5,505,497 allocs, 5,501,267 frees,
 375,443,749,639 bytes allocated
 ==1752==
 ==1752== LEAK SUMMARY:
 ==1752==    definitely lost: 9,723,940 bytes in 362 blocks
 ==1752==    indirectly lost: 4,069,220 bytes in 836 blocks
 ==1752==      possibly lost: 217,404 bytes in 197 blocks
 ==1752==    still reachable: 162,292 bytes in 2,835 blocks
 ==1752==         suppressed: 0 bytes in 0 blocks
 ==1752== Rerun with --leak-check=full to see details of leaked memory
 ==1752==
 ==1752== For counts of detected and suppressed errors, rerun with: -v
 ==1752== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
 }}}

 After 20 minutes nvenc takes 574 MB and vaapi 162 MB and these values
 aren't changing over time.

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


More information about the FFmpeg-trac mailing list