Gstreamer memory leak

I have a memory leak using gstreamer:

#include <iostream>
#include <string.h>
#include <glib.h>
#include <gst/gst.h>

using namespace std;

void info(const GstElement *const element)
{
        cout << "count: " << GST_OBJECT_REFCOUNT(element) << endl;
        cout << "disposing: " << GST_OBJECT_IS_DISPOSING(element) << endl;
}

int main()
{
    gst_init(NULL,NULL);
    GstElement *element = gst_pipeline_new("src");
    info(element);
    gst_object_unref(element);
    info(element);
    gst_deinit();
    return 0;
}

When I manage my code with valgrind, I get this result:

== 9098 == Command: ./test_gstreamer
== 9098 == 
count: 1
disposing: 0
count: 0
disposing: 0
== 9098 == 
== 9098 == HEAP SUMMARY:
== 9098 == in use at exit: 1,364,118 bytes in 2,199 blocks
== 9098 == total heap usage: 21,877 allocs, 19,678 frees, 3,899,417 bytes allocated
== 9098 == 
== 9098 == LEAK SUMMARY:
== 9098 == definitely lost: 60 bytes in 1 blocks
== 9098 == indirectly lost: 240 bytes in 10 blocks
== 9098 == possibly lost: 543,952 bytes in 880 blocks
== 9098 == still reachable: 819,866 bytes in 1,308 blocks
== 9098 == suppressed: 0 bytes in 0 blocks
== 9098 == Rerun with --leak-check = full to see details of leaked memory
== 9098 == 
== 9098 == For counts of detected and suppressed errors, rerun with: -v
==9098== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

gst_object_unref ? GST_OBJECT_IS_DISPOSING false gst_object_unref?

+3
2

:

gst_init(NULL,NULL);
GstElement *element = gst_pipeline_new("src");
info(element);
gst_element_set_state (element, GST_STATE_NULL);
gst_object_unref(element);
info(element);
return 0;

, .

+1

, valgrind: " --leak-check = full, ". . : http://gstreamer-devel.966125.n4.nabble.com/Valgrind-error-with-gstreamer-td4657149.html

, gst_object_unref.

+1

All Articles