GNOME Bugzilla – Bug 794316
Gst.Pipeline never disposes Gst.Bus
Last modified: 2018-11-03 11:09:01 UTC
To explain leakages, I created unit tests in my personal repository. https://github.com/justinjoy/Gst.Tests/blob/master/Gst.Tests/PipelineTests.cs There are 4 tests; - TestPipelineDispose: disposing of pipeline instance only (Test failed) - TestPieplineParseAndDispose: same as above, but the pipeline is created by Parser.Launch (Test failed) - TestPipelineDisposeManually: Explictly calling 'Dispose' for all exising element (Test passed) - TestPieplineUriDecodebinForcedlyDispose: Almost same as above, but disposing of child elements in 'deep-element-removed' callback. (Test passed) So what I found is that the binding causes leakages as long as a programmer doesn't manage Gst.Element, currently. But, still I am not sure if they should be managed in gstreamer-sharp, or application. I'll add some patches to make my unit tests pass successfully.
Created attachment 369646 [details] [review] Pipeline: Call Dispose to Gst.Bus When Gst.Pipeline is disposing, its internal Gst.Bus should be unreffed too. However, I am not sure if managing the instance of Gst.Bus is an application's responsibility.
> But, still I am not sure if they should be managed in gstreamer-sharp, or application. Simple rule of thumb: in C# you should never have to worry about memory leaks unless you yourself keep a reference to something around.
Review of attachment 369646 [details] [review]: ::: sources/custom/Pipeline.cs @@ +29,3 @@ + { + this.Bus.Dispose (); + base.Dispose(disposed); That this fixes it would suggest that the C# Bus wrapper object is leaked somehow, and with this fix the native GstBus would be disposed but the C# wrapper object stays around.
Created attachment 369647 [details] [review] Bin: Call Dispose for child elements
(In reply to Sebastian Dröge (slomo) from comment #2) > > But, still I am not sure if they should be managed in gstreamer-sharp, or application. > > Simple rule of thumb: in C# you should never have to worry about memory > leaks unless you yourself keep a reference to something around. Yes, in theory, I don't need to care about leakage. However, managed objects never been disposed while running application so it consumes memory gradually. That's the point to make me confused.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer-sharp/issues/3.