After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705863 - Memory leak in Gst::XImageSink::get_last_buffer
Memory leak in Gst::XImageSink::get_last_buffer
Status: RESOLVED OBSOLETE
Product: gstreamermm
Classification: Bindings
Component: general
0.10.x
Other Linux
: Normal normal
: ---
Assigned To: gstreamermm-maint
gstreamermm-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-12 16:59 UTC by Holger Seelig
Modified: 2017-04-21 13:59 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Holger Seelig 2013-08-12 16:59:56 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
Comment 1 Murray Cumming 2013-09-25 08:39:34 UTC
(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.
Comment 2 Murray Cumming 2017-04-21 13:59:48 UTC
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.