Encoder memory leak

Hi
I am encoding H264 video in two ways:

  1. using MM API using v4l2 api
  2. using gstreamer nvv4l2h264enc element
    I am seeing that there is memory leak (of 10MB) every open close of fd (MM API) or play stop (on gstreamer)
    I am doing it several times and see memory leak
    I am using L4T 32.7.3 version
    Can you help me?

Hi,
Please try 01_video_encode sample and see if you can reproduce the issue. It has the option:

     -s <loop-count>       Stress test [Default = 1]

If yes, please share the steps and we can set up developer kit to reproduce the issue.

Hi
I run stress=100 and I can see that there is a memory leak
I run encode test with I420 1920x1080 as input video
Do you need more information about my test?

Hi,
Please remove the prebuilt lib and see if you still observe the leak:

$ sudo rm /usr/lib//aarch64-linux-gnu/tegra/libv4l2_nvargus.so

I don’t use argus library, I only use encoder
I run the encoder sample application and see the memory leak

I reproduce the memory leak also on Orin using L4T 36.4 using mm api encoder example

Hi,
The software codes are very different between Jetpack 4 and 6. On Jetpack 4.6.3, please remove the lib and try.

Hi
Which library to remove? I did not get any so of encoder libraries

Hi,
Please remove the v4l2 lib mentioned previously.

I need to replace the v4l2 lib with another v4l2 lib, you gave me libv4l2_nvargus.so BUT I don’t use it, I use with the encoder example libnvv4l2.so and nvbuf_utils.so libraries

Hi,
All implemented v4l2 devices are loaded in initialization. So suggest remove it and try. If it’s not present, it’s not loaded.

Hi
I removed the file libv4l2_nvargus.so and there is still memory leak

Hi,
You may share how you check the memory. We run 01 sample and run top command. The memory of the process looks stable.

Hi
I look the total available memory using tegrastats, I saw that the total free memory decreasing.

Hi,
Please try
How to Clear RAM Memory Cache, Buffer, and Swap on Linux

Since top is stable while running 01 sample on developer kit, the memory may go to cache. It doesn’t look like leak.

I see that used memory increase when running with -s many times
You also see that the memory used by application does not increase
Can’t it be memory used by the driver?