Hi,
I have been tracking a memory leak in our gstreamer application for last two days, and I have been able to simplify the case into this situation: I create a pipeline and an element, put the element into the pipeline, than set the pipeline state to NULL. The pipeline gets disposed, but the element in it does not. This is the Python code to reproduce the behavior: ---------- import gi gi.require_version('Gst', '1.0') from gi.repository import Gst def run(): pipeline = Gst.Pipeline(name = 'pipeline') pipeline.add(Gst.ElementFactory.make('videotestsrc', 'my_elem')) pipeline.set_state(Gst.State.NULL) del pipeline pipeline = None input() def main(): Gst.init(None) run() if __name__ == '__main__': main() ---------- When I run the code with GST_DEBUG=8, let it wait inside the input() function and grep dispose, I see that the pipeline disposed correctly: gst_pipeline_dispose:<pipeline> dispose gst_bin_dispose:<pipeline> dispose gst_object_dispose:<bus0> dispose gst_element_dispose:<pipeline> dispose gst_object_dispose:<bus1> dispose gst_element_dispose:<pipeline> parent class dispose gst_object_dispose:<pipeline> dispose When I look at my_elem using grep REFCOUNTING | grep my_elem: gst_object_set_parent:<my_elem> set parent (ref and sink) gst_object_ref_sink:<my_elem> 0x25992d0 ref_sink 2->3 gst_object_unref:<my_elem> 0x25992d0 unref 2->1 I see that my_elem ends with ref count 1 and stays allocated. I tried to reproduce this case in C code as closely as possible: ---------- #include <stdio.h> #include <gst/gst.h> int run() { GstElement *detector = gst_element_factory_make ("videotestsrc", "my_elem"); GstElement *pipeline = gst_pipeline_new ("pipeline"); gst_bin_add (GST_BIN (pipeline), detector); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); getchar(); } int main() { gst_init (NULL, NULL); run (); gst_deinit (); return 0; } ---------- Now, my_elem gets disposed as expected after its refcount reaches 0: gst_object_set_parent:<my_elem> set parent (ref and sink) gst_object_ref_sink:<my_elem> 0x11530e0 ref_sink 1->2 gst_object_unref:<my_elem> 0x11530e0 unref 1->0 gst_element_dispose:<my_elem> dispose gst_object_unparent:<my_elem:src> unparent gst_element_dispose:<my_elem> parent class dispose gst_object_dispose:<my_elem> dispose gst_element_finalize:<my_elem> finalize gst_element_finalize:<my_elem> finalize parent gst_object_finalize:<my_elem> finalize Any ideas why Python bindings behave differently or what to try in order to dispose the element? Tested on Debian Jessie and GStreamer 1.4.4 -- Sent from: http://gstreamer-devel.966125.n4.nabble.com/ _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel |
On Fri, 2018-03-23 at 02:51 -0700, viktor.chvatal wrote:
> [...] > > Tested on Debian Jessie and GStreamer 1.4.4 This is a known problem and was fixed with 1.14: https://bugzilla.gnome.org/show_bug.cgi?id=730138 (and a couple of similar cases elsewhere) -- Sebastian Dröge, Centricular Ltd · https://www.centricular.com _______________________________________________ gstreamer-devel mailing list [hidden email] https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel signature.asc (981 bytes) Download Attachment |
Free forum by Nabble | Edit this page |