memory leak: hevc encoding
hi, i've found a memory leak that occurs on encoding video by ffmpeg.
valgrind --tool=memcheck --leak-check=full --log-file=webm_log.txt ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -s:v 720x1280 -i ./phone_720x1280_yuv420.yuv -vf format=nv12,hwupload -c:v hevc_vaapi -g 12 -bf 0 -y hevc_vbr_720x1280.hevc
log report:
==149911== Memcheck, a memory error detector
==149911== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==149911== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==149911== Command: ffmpeg -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -s:v 720x1280 -i ./phone_720x1280_yuv420.yuv -vf format=nv12,hwupload -c:v hevc_vaapi -g 12 -bf 0 -y hevc_vbr_720x1280.hevc
==149911== Parent PID: 138989
==149911==
==149911==
==149911== HEAP SUMMARY:
==149911== in use at exit: 291,798 bytes in 2,413 blocks
==149911== total heap usage: 121,948 allocs, 119,535 frees, 3,341,704,599 bytes allocated
==149911==
==149911== 432 (184 direct, 248 indirect) bytes in 1 blocks are definitely lost in loss record 298 of 317
==149911== at 0x484BD8C: malloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==149911== by 0x5742BF7: si_alloc_buffer_struct (si_buffer.c:566)
==149911== by 0x5742CAB: si_buffer_create (si_buffer.c:587)
==149911== by 0x5743197: si_resource_create (si_buffer.c:693)
==149911== by 0x5732A5B: pipe_buffer_create (u_inlines.h:304)
==149911== by 0x5732BAF: si_vid_create_buffer (radeon_video.c:65)
==149911== by 0x5730CC7: radeon_uvd_create_encoder (radeon_uvd_enc.c:304)
==149911== by 0x572112B: si_uvd_create_decoder (si_uvd.c:104)
==149911== by 0x5358C57: vlVaHandleVAEncSequenceParameterBufferTypeHEVC (picture_hevc_enc.c:133)
==149911== by 0x534C017: handleVAEncSequenceParameterBufferType (picture.c:412)
==149911== by 0x534C4DF: vlVaRenderPicture (picture.c:589)
==149911== by 0x49A3B4B: vaRenderPicture (va.c:1603)
==149911==
==149911== 2,464 (16 direct, 2,448 indirect) bytes in 1 blocks are definitely lost in loss record 306 of 317
==149911== at 0x484E0A4: calloc (in /usr/lib/aarch64-linux-gnu/valgrind/vgpreload_memcheck-arm64-linux.so)
==149911== by 0x57306E7: radeon_uvd_enc_begin_frame (radeon_uvd_enc.c:186)
==149911== by 0x534CAAF: vlVaEndPicture (picture.c:747)
==149911== by 0x49A3BFF: vaEndPicture (va.c:1621)
==149911== by 0xBDD99B: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0xBDEE8B: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x5D0CB7: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x286DD3: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x289FF7: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x28DFFB: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x26EDCB: ??? (in /usr/local/bin/ffmpeg)
==149911== by 0x4BFB877: (below main) (libc-start.c:314)
==149911==
==149911== LEAK SUMMARY:
==149911== definitely lost: 200 bytes in 2 blocks
==149911== indirectly lost: 2,696 bytes in 12 blocks
==149911== possibly lost: 0 bytes in 0 blocks
==149911== still reachable: 288,902 bytes in 2,399 blocks
==149911== suppressed: 0 bytes in 0 blocks
==149911== Reachable blocks (those to which a pointer was found) are not shown.
==149911== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==149911==
==149911== For lists of detected and suppressed errors, rerun with: -s
==149911== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)
System information
- OS: Ubuntu 20.04.2 LTS
- GPU: [AMD/ATI] Vega 10 XL/XT [Radeon RX Vega 56/64]
- Kernel version: Linux node164 5.11.0-20210601-generic #20210601 SMP PREEMPT Mon Jun 7 21:00:36 CST 2021 aarch64 aarch64 aarch64 GNU/Linux
- Mesa version: Mesa Gallium driver 21.1.8 for Radeon RX Vega (VEGA10, DRM 3.40.0, 5.11.0-20210601-generic, LLVM 11.0.0)