Memory leak issue in case nvv4l2camerasrc is used

we run below pipeline with enabling GST_TRACER in order to track some memory leak issue on AGX platform.
GST_DEBUG="*:7,GST_TRACER:7" GST_TRACERS=“leaks”

If nvv4l2camerasrc is used like below.

gst-launch-1.0 -e nvv4l2camerasrc name=nvv4l2camerasrc0 device=/dev/video0 ! capsfilter name=capsfilter0 caps=“video/x-raw(memory:NVMM),format=(string)UYVY,width=1920,height=1080,framerate=30/1” ! fakesink

GST_TRACER will detect memory leak with type-name GstNVV4l2MemoryAllocator.
GST_TRACER :0::[00m object-alive, type-name=(string)GstNVV4l2MemoryAllocator, address=(gpointer)0x5587bdef00, description=(string), ref-count=(uint)1, trace=(string);

Whereas if we replace nvv4l2camerasrc with nvv4l2src, GST_TRACER will not output any memory leak information. The pipeline is listed below.
gst-launch-1.0 -e v4l2src name=nvv4l2camerasrc0 device=/dev/video0 ! capsfilter name=capsfilter0 caps=“video/x-raw,format=(string)UYVY,width=1920,height=1080,framerate=30/1” ! fakesink

In addition, the issue will still there if I replace fakesink with nvvidconv ! xvimagesink in case nvv4l2camerasrc is used in pipeline.

Would you please kindly give us some support for this issue, is there memory leak problem in nvv4l2camerasrc? Thank.

Hi,
Please apply this and give it a try:
Memory Leak (Alloc/free mismatch) in Tegra multimedia API (encoder) - #6 by DaneLLL

This is known and please not to load the so file and check if it helps.

Thanks for your quick reply.

I execute below command and run same pipleline agian , the issue is still there, memory leak report is not disappeared.

sudo mv /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus.so /usr/lib/aarch64-linux-gnu/tegra/libv4l2_nvargus_back.so

Hi,
We should fix it on Jetpack 4.6.1(r32.7.1). Please download the source code and rebuild/replace

/usr/lib/aarch64-linux-gnu/gstreamer-1.0/libgstnvv4l2camerasrc.so

Ideally it should work by applying r32.7.1 to r32.6.1, but please back up the original prebuilt lib in case it fails to work.

Another way is to apply this change to source code of r32.6.1:

// apply the change to gst_nv_v4l2_camera_set_caps()
  if (allocator)
    gst_object_unref (allocator);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.