Gstreamer vpudec Memory leaking on i.MX 8M Plus Dear NXP team, We’ve encountered an issue on our device, which displays six camera feeds (800x600@60fps) on a Full HD screen. Our application uses a GStreamer-based pipeline [2] implemented in C++. When running this pipeline, we received error [6] after approximately 1.5 hours of uptime. The device is based on the i.MX 8M PLUS and runs Mickledore (kernel 6.1.36). Since Variscite has not modified GStreamer, I'm reaching out for your input. The kernel settings remain unchanged; by default, CmaTotal is set to 983040 kB. From what I understand, the VPU’s DMA usage reallocates CMA memory dynamically. We've observed a gradual decline in available CMA memory [3], and after approximately 531,723 seconds (around six days), the pipeline failed to allocate a contiguous block of 2040 pages, triggering error [4] and causing our application to crash. Initially, I suspected the issue might be related to the GStreamer vpudec plugin’s use of VPU memory (use-vpu-memory=true by default), so I disabled it. This seemed to temporarily stabilize cmaFree, but the available memory still gradually decreased and fluctuated over time. [5] We are displaying a static mosaic layout and rarely recreate the pipeline. Since the issue only occurs after several days of uptime, simply increasing CMA memory would likely delay the problem rather than resolve it. I’ve been monitoring /sys/kernel/debug/dma_buf/bufinfo regularly. On one device, after 16 hours and 27 minutes, I saw: "Total 176 objects, 377,487,360 bytes", and after 18 hours and 41 minutes: "Total 184 objects, 392,232,960 bytes". The hex value 01843200 also increased from 83 to 91, along with overall memory usage. [7] I’d appreciate your thoughts on this issue, and any recommendations you might have for a long-term solution or further diagnostics I should consider. Regards, Szilard B [1] dmesg_cma_error_device1.txt, dmesg_cma_error_device2.txt, dmesg_cma_error_device3.txt [2] gst-launch-1.0 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_0 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_1 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_2 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_3 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_4 \ rtspsrc location="rtsp://admin:
[email protected]/profile2/media.smp" latency=200 ! rtph265depay ! h265parse config-interval=-1 ! watchdog timeout=2000 ! vpudec disable-reorder=true ! videomixer.sink_5 \ imxcompositor_g2d name=videomixer \ sink_0::xpos=0 sink_0::ypos=0 sink_0::width=600 sink_0::height=480 \ sink_1::xpos=640 sink_1::ypos=0 sink_1::width=600 sink_1::height=480 \ sink_2::xpos=1280 sink_2::ypos=0 sink_2::width=600 sink_2::height=480 \ sink_3::xpos=0 sink_3::ypos=560 sink_3::width=600 sink_3::height=480 \ sink_4::xpos=640 sink_4::ypos=560 sink_4::width=600 sink_4::height=480 \ sink_5::xpos=1280 sink_5::ypos=560 sink_5::width=600 sink_5::height=480 \ ! waylandsink sync=false enable-last-sample=false qos=false enable-tile=true [3] cma-20250709-155500.log [4] cma: cma_alloc: linux,cma: alloc failed, req-size: 2040 pages, ret: -12 [5] cma-our-software-use-vpu-memory-false.log [6] 1:25:48.1 / 99:99:99. (gst-launch-1.0:123309): GStreamer-CRITICAL **: 12:56:03.228: gst_buffer_get_memory_range: assertion 'GST_IS_BUFFER (buffer)' failed (gst-launch-1.0:123309): GStreamer-CRITICAL **: 12:56:03.228: gst_buffer_peek_memory: assertion 'GST_IS_BUFFER (buffer)' failed (gst-launch-1.0:123309): GStreamer-CRITICAL **: 12:56:03.228: gst_mini_object_unref: assertion 'GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) > 0' failed ERROR: from element /GstPipeline:pipeline0/GstWatchdog:watchdog5: Watchdog triggered Additional debug info: /usr/src/debug/gstreamer1.0-plugins-bad/1.22.0.imx-r0/gst/debugutils/gstwatchdog.c(195): gst_watchdog_trigger (): /GstPipeline:pipeline0/GstWatchdog:watchdog5: Watchdog triggered Execution ended after 1:25:50.443886000 Setting pipeline to NULL ... Total showed frames (128758), playing for (1:25:50.444041500), fps (24.999). Freeing pipeline ... [7] device2_3x2-mosaic_16h27min.txt, device2_3x2-mosaic_18h41m.txt Re: Gstreamer vpudec Memory leaking on i.MX 8M Plus Hello @szilard_b_cib
I hope you are doing very well.
Unfortunately, I could not replicate by my side. Are you using the BSP from Variscite? Have you tried with our BSP?
I my case the CmaFree is always the same.
Best regards,
Salas.