After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769740 - gst_deinit: Not working as expected
gst_deinit: Not working as expected
Status: RESOLVED NOTABUG
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
1.8.2
Other Linux
: Normal normal
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-08-11 11:18 UTC by Julian Bouzas
Modified: 2016-08-11 15:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Julian Bouzas 2016-08-11 11:18:11 UTC
Hi there,

I am not sure if this is a bug or a misunderstanding but gst_deinit() does not seem to do what I expect. The documentation says it "cleans up any resources created by gst_init()" so I would expect something like that to work:

  int main() {
    gst_init(NULL, NULL);
    gst_deinit();
    gst_init(NULL, NULL);
  
    GstElement *element = gst_element_factory_make("identity", "identity");
    assert(element);
    g_object_unref(element);

    gst_deinit();
  }

But it doesn't as the element pointer is always NULL. If gst_init() cannot be used after a gst_deinit() call, what is the purpose of having a gst_deinit() API? It would be really nice for the testsuites to be able to go back to a NULL state before testing new units.

Also, libasan's address sanitizer shows a 16384 bytes memory leak in the following code:

  int main() {
    gst_init(NULL, NULL);
    gst_deinit();
  }

So the resources are not completely freed when calling gst_deinit(), could that explain why gst_init() does not work after gst_deinit()?

Thanks,
Comment 1 Tim-Philipp Müller 2016-08-11 11:32:06 UTC
Note the documentation

https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-Gst.html#gst-deinit

states that "After this call GStreamer (incl. this function) should not be used any more".

We explicitly don't support gst_init() after gst_deinit(). This is intentional.

The purpose of gst_deinit() is to make detecting some kind of leaks easier, by having GStreamer clean up some of its global state.

I don't know what leaks there, it might be a leak from GLib/GObject which doesn't have a way to clean up global allocations. You'd have to provide more details.
Comment 2 Julian Bouzas 2016-08-11 14:27:11 UTC
Hi Tim,

Thanks for your explanation. Can I ask why is that intentional? And, if we create a patch that adds that functionality, would it be accepted?
Comment 3 Tim-Philipp Müller 2016-08-11 15:00:10 UTC
We actually changed it to make it unsupported because we did not want to support it. A patch would likely be rejected, sorry :)