Memory Leackage in Gstreamer with DMA buffer

Hi guys,
We have memory leakage when we want push a DMA buffer in to a Gstreamer pipeline

GstFlowReturn ret;
GstBuffer* buffer_to_send;
buffer_to_send = gst_buffer_new_wrapped(surfaceDst, sizeof(NvBufSurface));
g_signal_emit_by_name(GST_APP_SRC (AppSrc), "push-buffer", buffer_to_send, &ret);

but if this function is used memory leakage is decreased but not solved completely.

GstFlowReturn ret;
            GstBuffer* buffer_to_send = gst_buffer_new_allocate(NULL, sizeof (NvBufSurface), NULL);
            gst_buffer_fill(buffer_to_send, 0, surfaceSrc, sizeof (NvBufSurface));
            GstSample * sample = gst_sample_new(buffer_to_send,nullptr,nullptr,nullptr);
            g_signal_emit_by_name(GST_APP_SRC (AppSrc), "push-sample", sample, &ret);
            gst_sample_unref(sample);
            gst_buffer_unref(buffer_to_send);

Which function from Gstreamer must be used to not having memory leakage when a DMA buffer is pushed in to Gstreamer pipeline.
Thanks so much.

Hi,
Please refer to the samples:
NvUtils NvBufSurface to gstreamer - #5 by DaneLLL
Opencv gpu mat into GStreamer without downloading to cpu - #15 by DaneLLL

Looks like yo don’t implement notify_to_destroy(). Please add it and try again.

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