<div dir="auto"><div>You are leaking the appsink since get_by_name returns a ref. You should also check the doc for get_buffer.<br><div class="gmail_extra"><br><div class="gmail_quote">Le 28 juil. 2017 11:28 PM, "Yuniesky Vasconcelo" <<a href="mailto:yvasconcelo@gmail.com">yvasconcelo@gmail.com</a>> a écrit :<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am developing an application that needs to create and remove the pipeline repeatedly. When I do this the memory of the application grows and grows, it never decreases. Even after 10 repetitions I remove all the pipeline and call gst_deinit and it is not released. This is the code:<br>void GstVideo::createPipeline()<br>    m_pipeline = ("filesrc location=/media/datos/video.<wbr>mp4 ! qtdemux ! avdec_h264 ! videoconvert ! video/x-raw,format=RGB ! appsink name=appsink");<br>    if(!err)<br>    {<br>        GstElement* sink = gst_bin_get_by_name((GstBin*)<wbr>m_pipeline, "appsink");<br>        gst_app_sink_set_emit_signals(<wbr>GST_APP_SINK(sink), TRUE);<br>        gst_app_sink_set_max_buffers(<wbr>GST_APP_SINK(sink), 1);<br>        gst_app_sink_set_drop(GST_APP_<wbr>SINK(sink), TRUE);<br>        g_signal_connect(sink, "new-sample", G_CALLBACK(GstVideo::<wbr>newSample), (gpointer)this);<br>        g_signal_connect(sink, "eos", G_CALLBACK(GstVideo::eos), (gpointer)this);<br>    }<br>    else<br>    {<br>        g_error_free(err);<br>    }<br>}<br><br><br>GstFlowReturn GstVideo::newSample(GstAppSink *sink, gpointer user_data)<br>{<br>    GstSample* sinkSample = gst_app_sink_pull_sample(GST_<wbr>APP_SINK(sink));<br>    if(sinkSample) {<br>    GstMapInfo info;<br>    GstBuffer* buffer  = gst_sample_get_buffer(<wbr>sinkSample);<br>    gst_buffer_map(buffer, &info, GST_MAP_READ);<br>    GstCaps *caps = gst_sample_get_caps(<wbr>sinkSample);<br>    GstStructure * structure = gst_caps_get_structure(caps, 0);<br><br>    [...]<br><br>    gst_buffer_unmap(buffer, &info);<br>    gst_sample_unref(sinkSample);<br>    }<br>    return GST_FLOW_OK;<br>}<br><br>GstVideo::~GstVideo()<br>{<br>    if(m_pipeline) {<br>        gst_element_set_state(m_<wbr>pipeline, GST_STATE_NULL);<br>        gst_object_unref( m_pipeline);<br>    }<br><br></div>
<br>______________________________<wbr>_________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.<wbr>freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/gstreamer-<wbr>devel</a><br>
<br></blockquote></div><br></div></div></div>