[gstreamer-bugs] [Bug 636804] New: Using appsink causes memory leak because buffers are double ref'ed by gst-sharp

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Dec 8 11:40:34 PST 2010


https://bugzilla.gnome.org/show_bug.cgi?id=636804
  GStreamer | gst-sharp | 0.10.x

           Summary: Using appsink causes memory leak because buffers are
                    double ref'ed by gst-sharp
    Classification: Desktop
           Product: GStreamer
           Version: 0.10.x
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: gst-sharp
        AssignedTo: gstreamer-bugs at lists.sourceforge.net
        ReportedBy: wilahti at gmail.com
         QAContact: gstreamer-bugs at lists.sourceforge.net
      GNOME target: ---
     GNOME version: ---


When using the appsink API with gstreamer-sharp to sip buffers via PullBuffer,
the underlying buffers are ref'ed one too many times, thus using Dispose() or
allowing garbage collection to dispose of a buffer will not cause it to be
freed, despite the fact that no actual references for the buffer exist anymore
(ie, the reference count of buffers after they are disposed is still 1). 

To confirm this (and also a workaround for affected users), I called
gst_mini_object_unref() manually before calling Dispose() and the memory
leaking stopped. 

This most likely means that gstreamer-sharp has one extra gst_mini_object_ref
call than needed when setting up the C# proxy object.

I plan on submitting a patch soon if I can manage to find the error but for
now, a manual call to gst_mini_object_unref before calling dispose (or allowing
the object to become garbage collected) is needed.

Just include this pinvoke somewhere:

[DllImport ("libgstreamer-0.10.dll") ]
static extern void gst_mini_object_unref (IntPtr raw);

And when you're done with the object you must:

gst_mini_object_unref(buffer.Handle);

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.




More information about the Gstreamer-bugs mailing list