GNOME Bugzilla – Bug 705863
Memory leak in Gst::XImageSink::get_last_buffer
Last modified: 2017-04-21 13:59:48 UTC
In gstreamermm is a memory leak with Gst::XImageSink::get_last_buffer. I used the following code to update a OpenGL texture every frame: Glib::RefPtr <Gst::Buffer> buffer = xImageSink -> get_last_buffer (); if (buffer) { ... } I figured out that the call to get_last_buffer causes a memory leak. The c version of this code works: GstBuffer* buffer = gst_base_sink_get_last_buffer (Glib::RefPtr <Gst::BaseSink>::cast_static (getVideoSink ()) -> gobj ()); if (buffer) { ... gst_buffer_unref (buffer); } I don't know if all VideoSinks are affected. I only tested Gst::XImageSink. I used gstreamermm-0.10-2 / 0.10.11-0ubuntu1 on Ubuntu 13.4 (Raring). The affected code can be seen in the source code of Titania at http://bazaar.launchpad.net/~holger-seelig/titania/trunk/view/head:/libtitania-x3d/Titania/X3D/Components/Texturing/MovieTexture.cpp
(I guess this is about the gstreamer-0.10 version of gstreamermm.) At first glance, Gst::BaseSink::get_last_buffer() seems to do the right thing. gst_base_sink_get_last_buffer() does indeed return a reference, that must be unreferenced: https://developer.gnome.org/gstreamer-libs/0.10/GstBaseSink.html#gst-base-sink-get-last-buffer But gstreamermm should cause that to happen when its RefPtr goes out of scope. That's why the .hg file's _WRAP_METHOD() for gst_base_sink_get_last_buffer() doesn't use the refreturn option. Maybe you could paste here the generated code for that method (both the const and non-const methods) in the .cc file. However, this method has been removed from the API in git master anyway: https://git.gnome.org/browse/gstreamermm/log/gstreamer/src/basesink.hg because it has been removed from the C API.
It would be nice to find out what the problem was, but I'm just closing this because the API doesn't exist now anyway.