GNOME Bugzilla – Bug 769740
gst_deinit: Not working as expected
Last modified: 2016-08-11 15:00:10 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,
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.
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?
We actually changed it to make it unsupported because we did not want to support it. A patch would likely be rejected, sorry :)