<div dir="ltr"><div>
    <div class="gmail-post-text">

<p>I am developing a program that need to create and delete a pipeline several times, but memory grows every time I do this. <br></p><p>So I developed this simple example for find out what is wrong, but memory leaks still appers.</p><p>I also do <span class="gmail-comment-copy"><code>GST_DEBUG=GST_REFCOUNTING:5, but nothing.<br></code></span></p>

<p><span id="gmail-result_box" class="gmail-" tabindex="-1" lang="en"><span>How should I properly release the memory used by a </span></span><span id="gmail-result_box" class="gmail-" tabindex="-1" lang="en"><span>pipeline?</span></span></p>

<p>I am using GStreamer 1.12.2 and Ubuntu 14.04.</p>

<p>For example this code:</p>

<pre><code>int main(int argc, char* argv[]) {
    g_print("gst_init...\n");
    gst_init(NULL, NULL);
    sleep(10);

    for (int pp = 0; pp < 10; pp++) {
        g_print("Iter #%d \n",pp);
        GstElement *pipeline;
        GError* err = NULL;

        pipeline = gst_parse_launch(
            " filesrc location=/media/datos/video12.mp4 "
            " ! qtdemux ! avdec_h264 ! videoconvert ! fakesink name=appsink",
            &err);

        if (err) {
            g_printerr(err->message);
            g_error_free(err);
            return -1;
        }
        gst_element_set_state(pipeline, GST_STATE_PLAYING);

        sleep(5);

        gst_element_set_state(pipeline, GST_STATE_NULL);
        gst_object_unref(GST_OBJECT(pipeline));
        sleep(5);
    }

    gst_deinit();
    g_print("gst_deinit...\n");
    sleep(10);

    return 0;
}
</code></pre>
    </div></div></div>