* [FFmpeg-devel] Suspected memory leak with CUDA detected by valgrind
@ 2025-09-11 14:59 Marco Oman via ffmpeg-devel
2025-09-11 16:24 ` [FFmpeg-devel] " Timo Rothenpieler via ffmpeg-devel
0 siblings, 1 reply; 2+ messages in thread
From: Marco Oman via ffmpeg-devel @ 2025-09-11 14:59 UTC (permalink / raw)
To: Dariusz Frankiewicz via ffmpeg-devel; +Cc: Marco Oman
Hi,
I compiled the example hw_decode.c on Ubuntu 24.04 with ffmpeg 7.0 compiled with --enable-cuda-nvcc. Then lauched the decoding over a small mp4 file with a video encoded H264 and checked the whole thing with valgrind with the following command:
valgrind --leak-check=yes --log-file=hw_decode.log ./hw_decode cuda a.mp4 a.raw
The resulting log is quite large, suggesting that there is a memory leak . Anyone found somehting similar?
Is the leak real or valgrind is giving a false positive?
Here there are two sections from hw_decode.log
==1495328== 48 bytes in 1 blocks are definitely lost in loss record 24 of 118
==1495328== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1495328== by 0x7029E01: pthread_cond_broadcast@GLIBC_2.2.5 (old_pthread_cond_broadcast.c:33)
==1495328== by 0x22095866: ???
==1495328== by 0x22064373: ???
==1495328== by 0x2201800E: ???
==1495328== by 0x4E3CC65: nvdec_test_capabilities (nvdec.c:127)
==1495328== by 0x4E3CC65: nvdec_decoder_create (nvdec.c:218)
==1495328== by 0x4E3CC65: ff_nvdec_decode_init (nvdec.c:404)
==1495328== by 0x4ADDBA3: hwaccel_init (decode.c:1193)
==1495328== by 0x4ADDBA3: ff_get_format (decode.c:1331)
==1495328== by 0x4BE3B97: get_pixel_format (h264_slice.c:909)
==1495328== by 0x4BE5A87: h264_init_ps (h264_slice.c:1142)
==1495328== by 0x4BE95F7: h264_field_start (h264_slice.c:1393)
==1495328== by 0x4BE95F7: ff_h264_queue_decode_slice (h264_slice.c:2150)
==1495328== by 0x4BEE8C5: decode_nal_units (h264dec.c:656)
==1495328== by 0x4BEE8C5: h264_decode_frame (h264dec.c:1058)
==1495328== by 0x4ADC4C9: decode_simple_internal (decode.c:409)
==1495328== by 0x4ADC4C9: decode_simple_receive_frame (decode.c:579)
==1495328== by 0x4ADC4C9: decode_receive_frame_internal (decode.c:608)
Plus many more of this kind
==1495328== 72 bytes in 1 blocks are possibly lost in loss record 44 of 118
==1495328== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==1495328== by 0xA91E6D9: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
==1495328== by 0xA80E7A9: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
==1495328== by 0xA7FF82C: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
==1495328== by 0xA7CD210: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
==1495328== by 0xA81B671: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
==1495328== by 0x5EB4E90: cuda_device_create (hwcontext_cuda.c:446)
==1495328== by 0x5EB177E: av_hwdevice_ctx_create (hwcontext.c:619)
==1495328== by 0x10A5A6: hw_decoder_init (in /home/marco/hw_decode)
==1495328== by 0x10AD66: main (in /home/marco/hw_decode)
________________________________________
Informativa sulla privacy e sulla sicurezza
Questo messaggio può contenere informazioni confidenziali ed è destinato esclusivamente all'indirizzo in intestazione. Il materiale e le informazioni contenuti e/o collegati a questo messaggio sono riservati e non divulgabili a terzi. Ai sensi della legge sul diritto d'autore e del codice civile, sono vietate la riproduzione o la modifica non espressamente autorizzata di questo materiale, o di parte di esso, con qualsiasi mezzo, in quanto di esclusiva proprietà di Innova S.p.A. o dei suoi danti causa. Persone diverse dal destinatario di questo messaggio non possono copiare o distribuire il messaggio stesso a terzi. Punti di vista od opinioni personali presenti in questo messaggio sono riconducibili direttamente al solo mittente del messaggio, e non rappresentano necessariamente il punto di vista o l'opinione di Innova S.p.A., salvo altrimenti specificato. Essendo Internet un canale di comunicazione non sicuro, Innova S.p.A. non è responsabile di eventuali modifiche, né della violazione, sottrazione o soppressione, occorse al messaggio dopo la spedizione da parte del mittente. Si raccomanda al destinatario di effettuare un controllo antivirus prima di aprire qualsiasi allegato alla presente. Innova S.p.A. non è responsabile di eventuali danni occorsi a seguito di virus informatici accidentalmente trasmessi tramite i contenuti del presente messaggio. Chiunque riceva questo messaggio per errore, è pregato di distruggerlo e di informare immediatamente il mittente con lo stesso mezzo e cancellarlo dai propri sistemi. Quanto precede ai fini del rispetto del Regolamento UE 2016/679 in materia di protezione dei dati personali. Per l'informativa estesa consultare il sito Internet di Innova S.p.A. sezione Privacy.
Disclaimer and confidentiality notice
This e-mail may contain confidential information and is intended only for the addressee named above and the contents should not be disclosed to any other person nor copies taken or forwarded. Any views or opinions presented are solely those of the sender and do not necessarily represent the views of Innova S.p.A. unless otherwise specifically stated. As not all internet communications are secure Innova S.p.A. does not accept legal responsibility for the contents of this message nor responsibility for any change or breach or subtraction or suppression of this message after it was sent by the original sender. We advise you to carry out your own virus check before opening any attachments as we cannot accept liability for any damage sustained as a result of any software viruses. Please notify the sender immediately if you have received this e-mail by mistake and delete it from your systems. This disclaimer according to GDPR Regulation EU 2016/679. Privacy-related information is available on the company website, Privacy section.
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 2+ messages in thread
* [FFmpeg-devel] Re: Suspected memory leak with CUDA detected by valgrind
2025-09-11 14:59 [FFmpeg-devel] Suspected memory leak with CUDA detected by valgrind Marco Oman via ffmpeg-devel
@ 2025-09-11 16:24 ` Timo Rothenpieler via ffmpeg-devel
0 siblings, 0 replies; 2+ messages in thread
From: Timo Rothenpieler via ffmpeg-devel @ 2025-09-11 16:24 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Timo Rothenpieler
[-- Attachment #1.1: Type: text/plain, Size: 3072 bytes --]
On 9/11/2025 4:59 PM, Marco Oman via ffmpeg-devel wrote:
> Hi,
> I compiled the example hw_decode.c on Ubuntu 24.04 with ffmpeg 7.0 compiled with --enable-cuda-nvcc. Then lauched the decoding over a small mp4 file with a video encoded H264 and checked the whole thing with valgrind with the following command:
Please try latest master, not some old version.
> valgrind --leak-check=yes --log-file=hw_decode.log ./hw_decode cuda a.mp4 a.raw
>
> The resulting log is quite large, suggesting that there is a memory leak . Anyone found somehting similar?
> Is the leak real or valgrind is giving a false positive?
>
> Here there are two sections from hw_decode.log
>
> ==1495328== 48 bytes in 1 blocks are definitely lost in loss record 24 of 118
> ==1495328== at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==1495328== by 0x7029E01: pthread_cond_broadcast@GLIBC_2.2.5 (old_pthread_cond_broadcast.c:33)
> ==1495328== by 0x22095866: ???
> ==1495328== by 0x22064373: ???
> ==1495328== by 0x2201800E: ???
> ==1495328== by 0x4E3CC65: nvdec_test_capabilities (nvdec.c:127)
> ==1495328== by 0x4E3CC65: nvdec_decoder_create (nvdec.c:218)
> ==1495328== by 0x4E3CC65: ff_nvdec_decode_init (nvdec.c:404)
> ==1495328== by 0x4ADDBA3: hwaccel_init (decode.c:1193)
> ==1495328== by 0x4ADDBA3: ff_get_format (decode.c:1331)
> ==1495328== by 0x4BE3B97: get_pixel_format (h264_slice.c:909)
> ==1495328== by 0x4BE5A87: h264_init_ps (h264_slice.c:1142)
> ==1495328== by 0x4BE95F7: h264_field_start (h264_slice.c:1393)
> ==1495328== by 0x4BE95F7: ff_h264_queue_decode_slice (h264_slice.c:2150)
> ==1495328== by 0x4BEE8C5: decode_nal_units (h264dec.c:656)
> ==1495328== by 0x4BEE8C5: h264_decode_frame (h264dec.c:1058)
> ==1495328== by 0x4ADC4C9: decode_simple_internal (decode.c:409)
> ==1495328== by 0x4ADC4C9: decode_simple_receive_frame (decode.c:579)
> ==1495328== by 0x4ADC4C9: decode_receive_frame_internal (decode.c:608)
>
> Plus many more of this kind
>
> ==1495328== 72 bytes in 1 blocks are possibly lost in loss record 44 of 118
> ==1495328== at 0x4848899: malloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==1495328== by 0xA91E6D9: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
> ==1495328== by 0xA80E7A9: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
> ==1495328== by 0xA7FF82C: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
> ==1495328== by 0xA7CD210: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
> ==1495328== by 0xA81B671: ??? (in /usr/lib/x86_64-linux-gnu/libcuda.so.570.133.20)
> ==1495328== by 0x5EB4E90: cuda_device_create (hwcontext_cuda.c:446)
> ==1495328== by 0x5EB177E: av_hwdevice_ctx_create (hwcontext.c:619)
> ==1495328== by 0x10A5A6: hw_decoder_init (in /home/marco/hw_decode)
> ==1495328== by 0x10AD66: main (in /home/marco/hw_decode)
>
These all point into nvidia code, so not much we can do about it if
they're real.
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4742 bytes --]
[-- Attachment #2: Type: text/plain, Size: 163 bytes --]
_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-09-11 16:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-11 14:59 [FFmpeg-devel] Suspected memory leak with CUDA detected by valgrind Marco Oman via ffmpeg-devel
2025-09-11 16:24 ` [FFmpeg-devel] " Timo Rothenpieler via ffmpeg-devel
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git