qmlglsink: Memory leak
Describe your issue
There is a memory leak using qmlglsink.
Reproduced with gst-plugins-good/tests/examples/qt/qmlsink-multisink
.
Expected Behavior
There should be no more live objects in memory when application closed.
Observed Behavior
When videoitem
is destroyed there are both GstCaps/GstPad live object.
There is an extra GstCaps at each stop/start of the pipeline.
If videoitem
is not destroyed, there are GstCaps,GstContext,GstGLContextGLX,GstGLDisplayX11,GstGLDisplayX11,GstGLWindowX11,GstGLWrappedContext,GstPad,GstQtSink
Setup
- Debian 9/11
- VM/Computer
- 1.10/1.16/1.18/Last
- Command line:
cmake -Hsubprojects/gst-plugins-good/tests/examples/qt/qmlsink-multisink/ -Bbuild
cmake --build build/
Steps to reproduce the bug
- open terminal
- type
./build/qmlsink-multisink
- click Quit
- read on the console all lives objects (see appendices)
- type
./build/qmlsink-multisink
- click on index to unset source
- read on the console all lives objects (see appendices)
- type
./build/qmlsink-multisink
- click on video to start/stop
- read on the console all lives objects (see appendices)
How reproducible is the bug?
systematic
Solutions you have tried
I try to remove glsink increment in void VideoItem::componentComplete()
, then there is only GstCaps/GstPad live when application Quit (if videoitem is destroyed)
The RenderJob (::AfterSwapStage) to unref sink is called only when video-item is destroyed (disable loader) before Quit.
Additional Information
Traces when application Quit. Traces when application Quit and video-item is destroyed. Traces when pipeline is start/stop 3 timesMemory leaks traces
0:00:05.015097802 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7ffab0002ad0, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)4, trace=(string);
0:00:05.015145702 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstContext, address=(gpointer)0x56027a412460, description=(string)context 'gst.gl.GLDisplay'='context, gst.gl.GLDisplay=(GstGLDisplay)"\(GstGLDisplayX11\)\ gldisplayx11-0";', ref-count=(uint)1, trace=(string);
0:00:05.015158802 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstGLContextGLX, address=(gpointer)0x7ffab00080f0, description=(string), ref-count=(uint)1, trace=(string);
0:00:05.015171502 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstGLDisplayX11, address=(gpointer)0x56027a4681e0, description=(string), ref-count=(uint)4, trace=(string);
0:00:05.015201001 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstGLDisplayX11, address=(gpointer)0x56027a4680e0, description=(string), ref-count=(uint)1, trace=(string);
0:00:05.015220401 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstGLWindowX11, address=(gpointer)0x56027a4586a0, description=(string), ref-count=(uint)1, trace=(string);
0:00:05.015241701 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstGLWrappedContext, address=(gpointer)0x56027a475190, description=(string), ref-count=(uint)1, trace=(string);
0:00:05.015266501 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstPad, address=(gpointer)0x56027a2ff530, description=(string), ref-count=(uint)2, trace=(string);
0:00:05.015290301 13732 0x56027a27ea40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstQtSink, address=(gpointer)0x56027a412f20, description=(string), ref-count=(uint)1, trace=(string);
0:00:05.068313771 14779 0x55c28fd6fa40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f7158002ad0, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)4, trace=(string);
0:00:05.068375471 14779 0x55c28fd6fa40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstPad, address=(gpointer)0x55c28fdef530, description=(string)<'':sink>, ref-count=(uint)1, trace=(string);
0:00:06.235596402 26980 0x55c1f471ba40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f85a00028f0, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)2, trace=(string);
0:00:06.235828202 26980 0x55c1f471ba40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f85a0002ad0, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)4, trace=(string);
0:00:06.235854002 26980 0x55c1f471ba40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f85a0002940, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)2, trace=(string);
0:00:06.235874002 26980 0x55c1f471ba40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x7f85a0002b20, description=(string)video/x-raw(memory:GLMemory), format=(string)RGBA, width=(int)320, height=(int)240, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, texture-target=(string)2D, ref-count=(uint)2, trace=(string);
0:00:06.235898702 26980 0x55c1f471ba40 TRACE GST_TRACER :0:: object-alive, type-name=(string)GstPad, address=(gpointer)0x55c1f479b530, description=(string)<'':sink>, ref-count=(uint)1, trace=(string);