Hi Mandar,
Either run valgrind --leak-check=full ./main which should give something similar to
==3150456== 32 bytes in 1 blocks are definitely lost in loss record 12 of 82
==3150456== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3150456== by 0x661F49D: ???
==3150456== by 0x661E808: ???
==3150456== by 0x660D3F1: ???
==3150456== by 0x661B45B: ???
==3150456== by 0x10931E: encode (a.c:21)
(being: e = nvenc->nvEncOpenEncodeSessionEx(&session_params, &encoder);)
==3150456== by 0x10972D: main (a.c:70)
[… ignore cuda …]
==3150456== 6,952 bytes in 1 blocks are definitely lost in loss record 77 of 82
==3150456== at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==3150456== by 0x68C5E94: ???
==3150456== by 0x68DD4C2: ???
==3150456== by 0x68BE367: ???
==3150456== by 0x661292E: ???
==3150456== by 0x660D609: ???
==3150456== by 0x661D168: ???
==3150456== by 0x10951A: encode (a.c:40)
(being: e = nvenc->nvEncInitializeEncoder(encoder, ¶ms);)
==3150456== by 0x10972D: main (a.c:70)
or uncomment row 70 (while(1)) and watch the process with ps or similar to see it grow continuously. Change to NV_ENC_PRESET_P5_GUID to see the problem go away.
This is also by customer care being tracked as: Bug 3200651 - NVENC bug [Incident: 201123-000219]
Kind regards,
Fredrik