Memory leak in JetPack 5.1.5 when repeating the start/stop cycle of a GStreamer pipeline including nvv4l2h265 encoder

Hi all,

Almost a couple of years ago, I created this post regarding a memory leak when using hardware encoders in JetPack 5.1.1.

I did a similar test in the following scenario:

• Hardware Platform (Jetson / GPU): Xavier AGX Devkit
• JetPack Version (valid for Jetson only): 5.1.5
• Check the RSS memory using the following script::
rss_memory.txt (352 Bytes)

To check the memory leak, I followed the next steps:

  1. Install the GStreamer Daemon (GstD) as explained in GStreamer Daemon GstD
  2. Install gst-perf GitHub - RidgeRun/gst-perf: GStreamer element to measure framerate, bitrate and CPU usage.
  3. Open three terminals. In terminal 1., run gstd
  4. In terminal two, run the following test script
    test.txt (589 Bytes)
  5. In terminal three, run the rss_memory script.

I ran the test for two hours and got the following graphic:

Then, I change the nvv4l2h265enc for the x265enc to confirm that the memory leak is only related to the hardware encoder. I got the following:

Based on the above results, the hardware encoder still has a memory leak.

According to the NVIDIA mod, the memory leak was resolved:

Questions for the NVIDIA team:

  1. Could you please try to reproduce the memory from your side?
  2. If you could confirm that the memory leak is present, is there a possibility that you can share the solution mentioned in Memory leak in JetPack 5.1.1 when repeating the start/stop cycle of a GStreamer pipeline including nvvideoconvert and nvv4l2h264/vp9 encoders - #8 by yuweiw

Regards!
Eduardo Salazar
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com

Hi,
Please apply the steps and check again:

  1. Remove the lib
$ sudo rm /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so
  1. Apply the fix and rebuild libnvv4l2.so:

Jetson/L4T/r36.4.x patches - eLinux.org
[gstreamer] Segmentation fault after restarting gstreamer pipeline

Hello @DaneLLL

Thanks for your reply and the steps provided. We are going to test it.

I would also like to ask if the fix can be replicated in JetPack 4.6.x?

Best regards!

Hi,
The code is significantly different between Jetpack 4 and 5. If you also observe leak on Jetpack 4, please create a new topic for clearness.