Hello!
I'm on GStreamer 1.24.4, JNA 5.14.0, Kotlin 2.0, Corretto 20, macOS Sonoma 14.5.
I've fiddled with GStreamer in the past, but now I'm basically using it for the first time by writing a simple "Hello World" using playbin3 and running it with:
GST_DEBUG=GST_TRACER:7
GST_TRACERS=leaks
It looks effectively like:
fun helloWorld(file: String) {
val playbin = Gst.parseLaunch("playbin3 uri=\"file://$file\"")
val lambda = MESSAGE { _, msg -> msg.dispose() }
playbin.bus.connect(lambda)
Gst::invokeLater {
playbin.play()
}
Thread.sleep(400)
Gst::invokeLater {
playbin.stop()
}
Thread.sleep(400)
Gst::invokeLater {
playbin.bus.disconnect(lambda)
playbin.bus.dispose()
}
Gst::invokeLater {
playbin.dispose()
}
Thread.sleep(2000)
System.gc()
Thread.sleep(2000)
}
After calling helloWorld(), I call System.gc() a few more times, then Thread.sleep for 10 seconds before manually calling Gst.deinit (just to get the leaks dump)
This seems to leak two objects:
GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x600000f81b80, description=(string)audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, ref-count=(uint)11, trace=(string);
GST_TRACER :0:: object-alive, type-name=(string)GstCaps, address=(gpointer)0x600000f81e50, description=(string)audio/x-raw, format=(string)S16LE, layout=(string)interleaved, rate=(int)44100, channels=(int)2, channel-mask=(bitmask)0x0000000000000003, ref-count=(uint)1, trace=(string);
If I run this in a loop, it leaks two GstCaps per run. The same things happens if I don't use invokeLater anywhere. If I process 10,000 files, I have 20,000 leaked GstCaps.
I'm not sure if it matters, but the files themselves are valid FLAC files.
What am I missing?
JAmes