How to properly release the memory used by a pipeline?

Yuniesky Vasconcelo yvasconcelo at gmail.com
Sat Sep 23 00:22:45 UTC 2017


I am developing a program that need to create and delete a pipeline several
times, but memory grows every time I do this.

So I developed this simple example for find out what is wrong, but memory
leaks still appers.

I also do GST_DEBUG=GST_REFCOUNTING:5, but nothing.

How should I properly release the memory used by a pipeline?

I am using GStreamer 1.12.2 and Ubuntu 14.04.

For example this 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;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170922/b0489771/attachment.html>


More information about the gstreamer-devel mailing list