Question about bindings

Sebastian Dröge sebastian at centricular.com
Mon Dec 12 10:46:39 UTC 2022


On Mon, 2022-12-12 at 07:49 +0330, Masoud MJ via gstreamer-devel wrote:
> I have a question about gstreamer bindings.
> Why there is no official binding available for Golang ?

Because nobody of the GStreamer team is maintaining Go bindings. There
are working and rather complete Go bindings at
  https://github.com/tinyzimmer/go-gst

Note however that these have the same problems by design as most other
bindings for languages with a tracing GC (e.g. C# and GJS but not
Python or Rust).
The GC can't know how "heavy" the C pointers are and only sees them as
a single pointer, while behind the pointer there could be lots of
references to other objects and huge memory allocations.

This has the effect that the GC considers all the C pointers as not
creating a lot of memory pressure and does not prioritize cleaning them
up.
So you can end up with the C objects staying around for a long time and
using up a lot of memory.

The only alternatives to that is to introduce manual memory management
in the bindings and require the user to explicitly get rid of values
they don't use anymore, or to have an GC API that allows the GC to
properly trace the C pointers.

As such you need to be careful in your application.

-- 
Sebastian Dröge, Centricular Ltd · https://www.centricular.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20221212/fb26c918/attachment.htm>


More information about the gstreamer-devel mailing list