Opened 2 years ago

Last modified 2 years ago

#8794 new defect

memory leak in qsv decoding

Reported by: fvb Owned by:
Priority: important Component: avcodec
Version: git-master Keywords: qsv leak
Cc: fredericbochmann@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Memory leak when decoding content through qsv decoders, rendered to system memory.

How to reproduce:

Run the below command for a 15-30 minutes and look at your system memory. This is specifically using the capability of rendering to system memory of qsv.

% ffmpeg -re -stream_loop -1 -c:v h264_qsv -i jellyfish-250-mbps-4k-uhd-h264.mkv -f null -

ffmpeg build settings:

ffmpeg version 4.3.git Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-39)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-bzlib --enable-libdrm --disable-crystalhd --enable-fontconfig --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libfdk-aac --enable-nonfree --enable-indev=jack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libmp3lame --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --enable-libsrt --enable-libmfx --enable-libxcb --disable-libzmq --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil      56. 55.100 / 56. 55.100
libavcodec     58. 95.100 / 58. 95.100
libavformat    58. 48.100 / 58. 48.100
libavdevice    58. 11.101 / 58. 11.101
libavfilter     7. 87.100 /  7. 87.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  8.100 /  5.  8.100
libswresample   3.  8.100 /  3.  8.100
libpostproc    55.  8.100 / 55.  8.100

built 2-3 days ago, ~ Tuesday 14th of July 2020

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (4)

comment:1 by fvb, 2 years ago

Cc: fredericbochmann@gmail.com added

comment:2 by fvb, 2 years ago

valgrind output at after some execution looks like this:

video:8093kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
==12396==
==12396== HEAP SUMMARY:
==12396==     in use at exit: 1,065,399,238 bytes in 209 blocks
==12396==   total heap usage: 1,551,647 allocs, 1,551,438 frees, 62,128,581,282 bytes allocated
==12396==
==12396== 4 bytes in 1 blocks are still reachable in loss record 1 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x15125E71: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x1519AA9B: g_private_get (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15172CBC: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15144C1D: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ACA: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==
==12396== 8 bytes in 1 blocks are still reachable in loss record 2 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x137C07F8: ??? (in /usr/lib64/libgomp.so.1.0.0)
==12396==    by 0x137CF61B: ??? (in /usr/lib64/libgomp.so.1.0.0)
==12396==    by 0x137BEE56: ??? (in /usr/lib64/libgomp.so.1.0.0)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==    by 0x1FFF00067E: ???
==12396==    by 0x1FFF000681: ???
==12396==
==12396== 32 bytes in 1 blocks are still reachable in loss record 3 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x1515B735: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15144C84: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ACA: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==    by 0x1FFF00067E: ???
==12396==
==12396== 32 bytes in 1 blocks are still reachable in loss record 4 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0xAC2660F: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26117: dlsym (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x1029D4CD: ??? (in /usr/lib64/libGLdispatch.so.0.0.0)
==12396==    by 0x1029AC58: ??? (in /usr/lib64/libGLdispatch.so.0.0.0)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==    by 0x1FFF00067E: ???
==12396==
==12396== 32 bytes in 1 blocks are still reachable in loss record 5 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x40075FC: expand_dynamic_string_token (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40085BC: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4014293: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==    by 0xB48F737: vaInitialize (in /usr/lib64/libva.so.2.800.0)
==12396==
==12396== 32 bytes in 1 blocks are still reachable in loss record 6 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x400B483: _dl_new_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4006013: _dl_map_object_from_fd (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4008659: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4014293: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==
==12396== 48 bytes in 2 blocks are still reachable in loss record 7 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x4019DF9: strdup (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4017033: _dl_load_cache_lookup (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40088F7: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400CC51: openaux (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400D45C: _dl_map_object_deps (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40142EA: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==
==12396== 48 bytes in 2 blocks are still reachable in loss record 8 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x400B483: _dl_new_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4006013: _dl_map_object_from_fd (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4008659: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400CC51: openaux (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400D45C: _dl_map_object_deps (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40142EA: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==
==12396== 64 bytes in 1 blocks are still reachable in loss record 9 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x1515B735: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15144C6F: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ACA: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==    by 0x1FFF00067E: ???
==12396==
==12396== 88 bytes in 1 blocks are still reachable in loss record 10 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x1515B6DD: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15172CDD: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15144C1D: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ACA: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==
==12396== 576 (176 direct, 400 indirect) bytes in 2 blocks are definitely lost in loss record 11 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D1F73: av_buffer_pool_init (buffer.c:241)
==12396==    by 0x5F1F647: qsv_decode_init (qsvdec.c:252)
==12396==    by 0x5F1F647: ff_qsv_process_data (qsvdec.c:618)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==    by 0x4275A0: decode_video (ffmpeg.c:2359)
==12396==    by 0x4275A0: process_input_packet (ffmpeg.c:2600)
==12396==    by 0x42A7A1: process_input (ffmpeg.c:4491)
==12396==    by 0x42A7A1: transcode_step (ffmpeg.c:4611)
==12396==    by 0x42A7A1: transcode (ffmpeg.c:4665)
==12396==
==12396== 600 bytes in 1 blocks are possibly lost in loss record 12 of 27
==12396==    at 0x4C2A593: operator new(unsigned long) (vg_replace_malloc.c:344)
==12396==    by 0x22132B18: ??? (in /usr/lib64/dri/iHD_drv_video.so)
==12396==    by 0x2200E5D8: ??? (in /usr/lib64/dri/iHD_drv_video.so)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x401458D: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==
==12396== 792 bytes in 3 blocks are still reachable in loss record 13 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x401115D: _dl_check_map_versions (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40145D0: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==    by 0xB48F737: vaInitialize (in /usr/lib64/libva.so.2.800.0)
==12396==    by 0x78E1339: vaapi_device_connect (hwcontext_vaapi.c:1462)
==12396==
==12396== 1,000 bytes in 1 blocks are still reachable in loss record 14 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x40139E3: add_to_global (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40148AF: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==    by 0xB48F737: vaInitialize (in /usr/lib64/libva.so.2.800.0)
==12396==    by 0x78E1339: vaapi_device_connect (hwcontext_vaapi.c:1462)
==12396==
==12396== 1,192 bytes in 1 blocks are still reachable in loss record 15 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x400B1EE: _dl_new_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4006013: _dl_map_object_from_fd (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4008659: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4014293: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC265AC: _dlerror_run (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xAC26040: dlopen@@GLIBC_2.2.5 (in /usr/lib64/libdl-2.17.so)
==12396==    by 0xB48E521: ??? (in /usr/lib64/libva.so.2.800.0)
==12396==
==12396== 1,320 bytes in 15 blocks are indirectly lost in loss record 16 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D1F73: av_buffer_pool_init (buffer.c:241)
==12396==    by 0x5F1F647: qsv_decode_init (qsvdec.c:252)
==12396==    by 0x5F1F647: ff_qsv_process_data (qsvdec.c:618)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==    by 0x4275A0: decode_video (ffmpeg.c:2359)
==12396==    by 0x4275A0: process_input_packet (ffmpeg.c:2600)
==12396==    by 0x42A7A1: process_input (ffmpeg.c:4491)
==12396==    by 0x42A7A1: transcode_step (ffmpeg.c:4611)
==12396==    by 0x42A7A1: transcode (ffmpeg.c:4665)
==12396==
==12396== 1,360 bytes in 34 blocks are indirectly lost in loss record 17 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D20B9: pool_alloc_buffer (buffer.c:320)
==12396==    by 0x78D20B9: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1ECB3: get_surface (qsvdec.c:380)
==12396==    by 0x5F1ECB3: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==
==12396== 1,440 bytes in 36 blocks are indirectly lost in loss record 18 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D20B9: pool_alloc_buffer (buffer.c:320)
==12396==    by 0x78D20B9: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1EDDF: get_surface (qsvdec.c:380)
==12396==    by 0x5F1EDDF: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==
==12396== 2,032 bytes in 1 blocks are still reachable in loss record 19 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x1515B735: g_malloc0 (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x151257A6: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15172E24: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15144C1D: g_hash_table_new_full (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ACA: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==
==12396== 2,354 bytes in 2 blocks are still reachable in loss record 20 of 27
==12396==    at 0x4C2C089: calloc (vg_replace_malloc.c:762)
==12396==    by 0x400B1EE: _dl_new_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4006013: _dl_map_object_from_fd (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4008659: _dl_map_object (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400CC51: openaux (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400D45C: _dl_map_object_deps (in /usr/lib64/ld-2.17.so)
==12396==    by 0x40142EA: dl_open_worker (in /usr/lib64/ld-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4013B7A: _dl_open (in /usr/lib64/ld-2.17.so)
==12396==    by 0xAC25FAA: dlopen_doit (in /usr/lib64/libdl-2.17.so)
==12396==    by 0x400F7C3: _dl_catch_error (in /usr/lib64/ld-2.17.so)
==12396==
==12396== 16,384 bytes in 1 blocks are still reachable in loss record 21 of 27
==12396==    at 0x4C29F73: malloc (vg_replace_malloc.c:309)
==12396==    by 0x1515B6DD: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15166ADB: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x15151B39: ??? (in /usr/lib64/libglib-2.0.so.0.5600.1)
==12396==    by 0x400F9B2: _dl_init (in /usr/lib64/ld-2.17.so)
==12396==    by 0x4001179: ??? (in /usr/lib64/ld-2.17.so)
==12396==    by 0xA: ???
==12396==    by 0x1FFF000666: ???
==12396==    by 0x1FFF00066D: ???
==12396==    by 0x1FFF000671: ???
==12396==    by 0x1FFF00067E: ???
==12396==    by 0x1FFF000681: ???
==12396==
==12396== 37,602,144 (120 direct, 37,602,024 indirect) bytes in 3 blocks are definitely lost in loss record 22 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D20B9: pool_alloc_buffer (buffer.c:320)
==12396==    by 0x78D20B9: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1ECB3: get_surface (qsvdec.c:380)
==12396==    by 0x5F1ECB3: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==
==12396== 50,135,040 bytes in 4 blocks are indirectly lost in loss record 23 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78D1BD7: av_buffer_alloc (buffer.c:72)
==12396==    by 0x78D1C4C: av_buffer_allocz (buffer.c:85)
==12396==    by 0x78D2154: pool_alloc_buffer (buffer.c:315)
==12396==    by 0x78D2154: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1ECB3: get_surface (qsvdec.c:380)
==12396==    by 0x5F1ECB3: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==
==12396== 112,803,840 bytes in 9 blocks are indirectly lost in loss record 24 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78D1BD7: av_buffer_alloc (buffer.c:72)
==12396==    by 0x78D1C4C: av_buffer_allocz (buffer.c:85)
==12396==    by 0x78D2154: pool_alloc_buffer (buffer.c:315)
==12396==    by 0x78D2154: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1EDDF: get_surface (qsvdec.c:380)
==12396==    by 0x5F1EDDF: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==
==12396== 125,341,056 (480 direct, 125,340,576 indirect) bytes in 12 blocks are definitely lost in loss record 25 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78E780D: av_mallocz (mem.c:239)
==12396==    by 0x78D20B9: pool_alloc_buffer (buffer.c:320)
==12396==    by 0x78D20B9: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1EDDF: get_surface (qsvdec.c:380)
==12396==    by 0x5F1EDDF: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==    by 0x42090F: decode (ffmpeg.c:2217)
==12396==
==12396== 413,614,080 bytes in 33 blocks are possibly lost in loss record 26 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78D1BD7: av_buffer_alloc (buffer.c:72)
==12396==    by 0x78D1C4C: av_buffer_allocz (buffer.c:85)
==12396==    by 0x78D2154: pool_alloc_buffer (buffer.c:315)
==12396==    by 0x78D2154: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1ECB3: get_surface (qsvdec.c:380)
==12396==    by 0x5F1ECB3: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==
==12396== 488,816,640 bytes in 39 blocks are possibly lost in loss record 27 of 27
==12396==    at 0x4C2C375: memalign (vg_replace_malloc.c:908)
==12396==    by 0x4C2C43F: posix_memalign (vg_replace_malloc.c:1072)
==12396==    by 0x78E761F: av_malloc (mem.c:86)
==12396==    by 0x78D1BD7: av_buffer_alloc (buffer.c:72)
==12396==    by 0x78D1C4C: av_buffer_allocz (buffer.c:85)
==12396==    by 0x78D2154: pool_alloc_buffer (buffer.c:315)
==12396==    by 0x78D2154: av_buffer_pool_get (buffer.c:352)
==12396==    by 0x5F1E964: ff_qsv_get_continuous_buffer (qsvdec.c:81)
==12396==    by 0x5F1E964: alloc_frame (qsvdec.c:301)
==12396==    by 0x5F1EDDF: get_surface (qsvdec.c:380)
==12396==    by 0x5F1EDDF: qsv_decode (qsvdec.c:427)
==12396==    by 0x5F1F533: ff_qsv_process_data (qsvdec.c:624)
==12396==    by 0x5F1F7A4: qsv_decode_frame (qsvdec_h2645.c:157)
==12396==    by 0x5C21266: decode_simple_internal (decode.c:342)
==12396==    by 0x5C21266: decode_simple_receive_frame (decode.c:538)
==12396==    by 0x5C21266: decode_receive_frame_internal (decode.c:556)
==12396==    by 0x5C21C77: avcodec_send_packet (decode.c:614)
==12396==
==12396== LEAK SUMMARY:
==12396==    definitely lost: 776 bytes in 17 blocks
==12396==    indirectly lost: 162,943,000 bytes in 98 blocks
==12396==      possibly lost: 902,431,320 bytes in 73 blocks
==12396==    still reachable: 24,142 bytes in 21 blocks
==12396==         suppressed: 0 bytes in 0 blocks
==12396==
==12396== For lists of detected and suppressed errors, rerun with: -s
==12396== ERROR SUMMARY: 10000006 errors from 104 contexts (suppressed: 0 from 0)

comment:3 by Carl Eugen Hoyos, 2 years ago

Keywords: memory removed

comment:4 by Xu Guangxin, 2 years ago

Hi fvb,
the file is large. could you use a smaller one to reproduce the issue?
I tried the latest code with jellyfish-3-mbps-hd-h264.mkv
It's no leak.

thanks

==14492== HEAP SUMMARY:
==14492== in use at exit: 3,677 bytes in 11 blocks
==14492== total heap usage: 16,853 allocs, 16,842 frees, 53,434,200 bytes allocated
==14492==
==14492== LEAK SUMMARY:
==14492== definitely lost: 0 bytes in 0 blocks
==14492== indirectly lost: 0 bytes in 0 blocks
==14492== possibly lost: 0 bytes in 0 blocks
==14492== still reachable: 3,677 bytes in 11 blocks
==14492== suppressed: 0 bytes in 0 blocks
==14492== Reachable blocks (those to which a pointer was found) are not shown.
==14492== To see them, rerun with: --leak-check=full --show-leak-kinds=all

Note: See TracTickets for help on using tickets.