GNOME Bugzilla – Bug 509559
[gstinfo]_gst_debug_init() memory leak
Last modified: 2008-02-05 20:01:30 UTC
gst debug has no deinit() funtion, if application invokes while() { gst_init() gst_deinit() } It will cause _gst_debug_init() memory leak and multiple output per log. In gst_init(), it invokes _gst_debug_init(), but _gst_debug_init() has no check for "initalized", it will new many debug categories every time, that will cause memory leak, and after that, if we want to output a log, this log will be printed many times. Changed files: gst/gstinfo.c Motorola would like to contribute gstreamer patch to the gstreamer open source community project. Please find attached the patch applicable for gstreamer. For any questions, please feel free to contact (Zhao Liang "e3423c@motorola.com", Shi Ling "w20230@motorola.com").
Created attachment 102885 [details] [review] gstinfo.c patch
Please create patches using diff -u
Also, being able to call gst_init() after calling gst_deinit() is not a goal. gst_deinit() is only supposed to be called when exiting a process, mainly for memory leak checking.
I think it could not be restricted that application must calls gst_deinit when it want to exit, because maybe the application just wants to a few functions from gstreamer, and after that, all gstreamer resource should be removed. In current implementation, many global variables are used, but no deinit() for gst debug, I think if we don't check whether it is already initialized, it will cause memory leak and abnormal log output. We could not expect application can do it well.
Created attachment 102954 [details] [review] new patch with "diff -u"
Created attachment 103014 [details] [review] Don't allow gst_init() to be called after gst_deinit() The bug is that gst_deinit() makes it possible for gst_init() to be called again. Patch fixes this.
By your patch, I think gstreamer can be considered as a resident library, when application use it, all the resources can not be released untill exiting application. I find not only gst debug but also gst_event, gst_buffer, gst_message, gst_tag all have no deinit, even in gst_deinit, these resources are not be released. Is it right?
Can you provide a concrete use case of an application that would initialize GStreamer and then deinitialize it to remove those resources ? [This bug is part of Fluendo support for Motorola.]
For example, Multimedia message application, it is often a daemon process, so no much resources expense are expected when it is idle, but if we want to use gstreamer do multimedia playback, it would alway occupy much memory even it is free. By my investigation, current gstreamer lets OS to release all resources when do exit. even in gst_deinit, no all resources are released.
2008-02-05 David Schleef <ds@schleef.org> * gst/gst.c: Add a separate gst_deinitialized that prevents gst_init() from being called after gst_deinit(). Fixes #509559 It's pretty clear from discussions on IRC that none of the core developers think we should support multiple init/deinit cycles. It's not how gstreamer, gobject, or glib is designed.