Qmlglsink: memory leak

qmlglsink memory leak issues have been reported at https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1614 but I still seeing similar issues on 1.24.9 when testing the example program from https://github.com/dv1/qmlglsink-example.

When executing with TRACE, I got the following memory leak log. Can anyone help.

  • Platform: arm&linux
  • graphic platform: eglfs

GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG="GST_TRACER:7" GST_TRACERS="leaks" ./qmlglsink-example -i test_video.mp4

GST_TRACER :0:: object-alive, type-name=(string)GstTagList, address=(gpointer)0xe84a0270, description=(string)taglist, audio-codec=(string)"MPEG-4\ AAC", maximum-bitrate=(uint)189000, bitrate=(uint)189000, container-specific-track-id=(string)2, minimum-bitrate=(uint)140913;, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstTagList, address=(gpointer)0xe84a0db0, description=(string)taglist, video-codec=(string)"H.265\ \(Main\ Profile\)", container-specific-track-id=(string)1, bitrate=(uint)1758971, minimum-bitrate=(uint)9600, maximum-bitrate=(uint)23753520;, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstStreamCollection, address=(gpointer)0xe8450750, description=(string)collection 0xe8450750 (2 streams) < stream video 0xe8450130, ID 7f2920605d60ad86e307bdf231615d8ab4f449dd5c7218e9ff7140fa9443f887/001, flags 0x0, caps [video/x-h265, stream-format=(string)hvc1, alignment=(string)au, level=(string)4, tier=(string)main, profile=(string)main, codec_data=(buffer)01016000000090000000000078f000fcfdf8f800000f03200001001940010c01ffff01600000030090000003000003007898a11024210001002b420101016000000300900000030000030078a003c08010e5966284649136a9a020000003002000000303c122000200074401c1376b822400084401504ddf822400, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true], tags [taglist, video-codec=(string)"H.265\ \(Main\ Profile\)", container-specific-track-id=(string)1, bitrate=(uint)1758971, minimum-bitrate=(uint)9600, maximum-bitrate=(uint)23753520;], stream audio 0xe8450440, ID 7f2920605d60ad86e307bdf231615d8ab4f449dd5c7218e9ff7140fa9443f887/002, flags 0x0, caps [audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2], tags [taglist, audio-codec=(string)"MPEG-4\ AAC", maximum-bitrate=(uint)189000, bitrate=(uint)189000, container-specific-track-id=(string)2, minimum-bitrate=(uint)140913;], >, ref-count=(uint)1, trace=(string);

 GST_TRACER :0:: object-alive, type-name=(string)GstStream, address=(gpointer)0xe8450440, description=(string)stream audio 0xe8450440, ID 7f2920605d60ad86e307bdf231615d8ab4f449dd5c7218e9ff7140fa9443f887/002, flags 0x0, caps [audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2], tags [taglist, audio-codec=(string)"MPEG-4\ AAC", maximum-bitrate=(uint)189000, bitrate=(uint)189000, container-specific-track-id=(string)2, minimum-bitrate=(uint)140913;], ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstStream, address=(gpointer)0xe8450130, description=(string)stream video 0xe8450130, ID 7f2920605d60ad86e307bdf231615d8ab4f449dd5c7218e9ff7140fa9443f887/001, flags 0x0, caps [video/x-h265, stream-format=(string)hvc1, alignment=(string)au, level=(string)4, tier=(string)main, profile=(string)main, codec_data=(buffer)01016000000090000000000078f000fcfdf8f800000f03200001001940010c01ffff01600000030090000003000003007898a11024210001002b420101016000000300900000030000030078a003c08010e5966284649136a9a020000003002000000303c122000200074401c1376b822400084401504ddf822400, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true], tags [taglist, video-codec=(string)"H.265\ \(Main\ Profile\)", container-specific-track-id=(string)1, bitrate=(uint)1758971, minimum-bitrate=(uint)9600, maximum-bitrate=(uint)23753520;], ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstMemory, address=(gpointer)0xe84b8cc0, description=(string)0xe84b8cc0, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstMemory, address=(gpointer)0xe84182e0, description=(string)0xe84182e0, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0xe84a0cc0, description=(string)video/x-h265, stream-format=(string)hvc1, alignment=(string)au, level=(string)4, tier=(string)main, profile=(string)main, codec_data=(buffer)01016000000090000000000078f000fcfdf8f800000f03200001001940010c01ffff01600000030090000003000003007898a11024210001002b420101016000000300900000030000030078a003c08010e5966284649136a9a020000003002000000303c122000200074401c1376b822400084401504ddf822400, width=(int)1920, height=(int)1080, framerate=(fraction)30/1, pixel-aspect-ratio=(fraction)1/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0xe84a02d0, description=(string)audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstBuffer, address=(gpointer)0xe8440460, description=(string)buffer: 0xe8440460, pts 99:99:99.999999999, dts 99:99:99.999999999, dur 99:99:99.999999999, size 2, offset none, offset_end none, flags 0x0, ref-count=(uint)1, trace=(string);

GST_TRACER :0:: object-alive, type-name=(string)GstBuffer, address=(gpointer)0xe8440aa0, description=(string)buffer: 0xe8440aa0, pts 99:99:99.999999999, dts 99:99:99.999999999, dur 99:99:99.999999999, size 123, offset none, offset_end none, flags 0x0, ref-count=(uint)1, trace=(string);

I have tried:

run official multi-sink example with (set a timer(5s) to quit and execute gst_deinit)

GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG="GST_TRACER:7" GST_TRACERS="leaks" ./qml-example

it does not throw any leak error.

When I simply replace the pipeline with playbin3 and set “uri” in the VideoItem construction function, it does throw leak errors similar with those above.

I finally realize it may be a issue of “decodebin3”.

GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG="GST_TRACER:7" GST_TRACERS="leaks" gst-launch-1.0 playbin uri=file:///path/to/video

This is OK.
But when it comes to

GST_LEAKS_TRACER_STACK_TRACE=1 GST_DEBUG="GST_TRACER:7" GST_TRACERS="leaks" gst-launch-1.0 playbin3 uri=file:///path/to/video

It throws leak errors.