Opened 7 years ago
Closed 6 years ago
#6593 closed defect (fixed)
Memory leaks in the dnxhd encoder
Reported by: | Carl Eugen Hoyos | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | avcodec |
Version: | git-master | Keywords: | dnxhd leak |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
The dnxhd encoder leaks on failed initialization:
$ valgrind --leak-check=full ./ffmpeg_g -f rawvideo -s hd1080 -i /dev/zero -thread_type slice -threads 32 -c:v dnxhd -b:v 36M -qmax 1 -f null - ==7232== Memcheck, a memory error detector ==7232== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al. ==7232== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info ==7232== Command: ./ffmpeg_g -f rawvideo -s hd1080 -i /dev/zero -thread_type slice -threads 32 -c:v dnxhd -b:v 36M -qmax 1 -f null - ==7232== ffmpeg version N-86995-g28e9ba9 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 6.3.0 (GCC) configuration: --enable-gpl libavutil 55. 74.100 / 55. 74.100 libavcodec 57.102.100 / 57.102.100 libavformat 57. 76.100 / 57. 76.100 libavdevice 57. 7.100 / 57. 7.100 libavfilter 6. 99.100 / 6. 99.100 libswscale 4. 7.102 / 4. 7.102 libswresample 2. 8.100 / 2. 8.100 libpostproc 54. 6.100 / 54. 6.100 Input #0, rawvideo, from '/dev/zero': Duration: N/A, start: 0.000000, bitrate: 622080 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1920x1080, 622080 kb/s, 25 tbr, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo (native) -> dnxhd (native)) Press [q] to stop, [?] for help [dnxhd @ 0x851c480] Application has requested 32 threads. Using a thread count greater than 16 is not recommended. [dnxhd @ 0x851c480] qmax must be at least 2 Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height Conversion failed! ==7232== ==7232== HEAP SUMMARY: ==7232== in use at exit: 321,581 bytes in 51 blocks ==7232== total heap usage: 2,131 allocs, 2,080 frees, 8,839,503 bytes allocated ==7232== ==7232== 63 bytes in 1 blocks are definitely lost in loss record 3 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425F68: dnxhd_encode_init (dnxhdenc.c:216) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 80 bytes in 1 blocks are definitely lost in loss record 4 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0xA1A7D8: ff_slice_thread_init (pthread_slice.c:144) ==7232== by 0xAF626D: avcodec_open2 (utils.c:822) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 126 bytes in 1 blocks are definitely lost in loss record 5 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425F4E: dnxhd_encode_init (dnxhdenc.c:214) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 272 bytes in 1 blocks are definitely lost in loss record 7 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x42627D: dnxhd_encode_init (dnxhdenc.c:513) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 272 bytes in 1 blocks are definitely lost in loss record 8 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x42629D: dnxhd_encode_init (dnxhdenc.c:515) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 512 bytes in 1 blocks are definitely lost in loss record 9 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425BDF: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 512 bytes in 1 blocks are definitely lost in loss record 10 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425C15: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 512 bytes in 1 blocks are definitely lost in loss record 11 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425C47: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 512 bytes in 1 blocks are definitely lost in loss record 12 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425C79: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 4,096 bytes in 1 blocks are definitely lost in loss record 14 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425F34: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 8,160 bytes in 1 blocks are definitely lost in loss record 15 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x4262D4: dnxhd_encode_init (dnxhdenc.c:519) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 8,928 bytes in 31 blocks are possibly lost in loss record 16 of 21 ==7232== at 0x4C292B8: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4010E69: allocate_dtv (in /lib64/ld-2.15.so) ==7232== by 0x401157D: _dl_allocate_tls (in /lib64/ld-2.15.so) ==7232== by 0x5897619: pthread_create@@GLIBC_2.2.5 (in /lib64/libpthread-2.15.so) ==7232== by 0x10729D7: avpriv_slicethread_create (slicethread.c:151) ==7232== by 0xA1A7F9: ff_slice_thread_init (pthread_slice.c:145) ==7232== by 0xAF626D: avcodec_open2 (utils.c:822) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 16,320 bytes in 1 blocks are definitely lost in loss record 17 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x4262BC: dnxhd_encode_init (dnxhdenc.c:517) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 16,384 bytes in 1 blocks are definitely lost in loss record 18 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x425F0C: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 65,280 bytes in 1 blocks are definitely lost in loss record 19 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x4261E6: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 65,280 bytes in 1 blocks are definitely lost in loss record 20 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x42622D: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== 130,560 bytes in 1 blocks are definitely lost in loss record 21 of 21 ==7232== at 0x4C290FE: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x4C291A7: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==7232== by 0x105826F: av_mallocz (mem.c:87) ==7232== by 0x426191: dnxhd_encode_init (mem.h:233) ==7232== by 0xAF6457: avcodec_open2 (utils.c:1020) ==7232== by 0x49A3D8: init_output_stream.constprop.23 (ffmpeg.c:3469) ==7232== by 0x49F875: reap_filters (ffmpeg.c:1442) ==7232== by 0x480678: main (ffmpeg.c:4553) ==7232== ==7232== LEAK SUMMARY: ==7232== definitely lost: 308,941 bytes in 16 blocks ==7232== indirectly lost: 0 bytes in 0 blocks ==7232== possibly lost: 8,928 bytes in 31 blocks ==7232== still reachable: 3,712 bytes in 4 blocks ==7232== suppressed: 0 bytes in 0 blocks ==7232== Reachable blocks (those to which a pointer was found) are not shown. ==7232== To see them, rerun with: --leak-check=full --show-reachable=yes ==7232== ==7232== For counts of detected and suppressed errors, rerun with: -v ==7232== ERROR SUMMARY: 23 errors from 19 contexts (suppressed: 2 from 2)
Similar for ffmpeg -f rawvideo -s hd1080 -i /dev/zero -thread_type slice -threads 33 -c:v dnxhd -b:v 36M -qmax 2 -f null -
and for invalid pix_fmt - profile combinations.
Note:
See TracTickets
for help on using tickets.
Mostly fixed by Paul in aeb73c73e112130fe344529bebb71bca3d286cb9, new ticket is #7394.