Provide a generic reference counting API
Submitted by Evan Nemerson
Link to original bug (#678619)
Description
As bindings for languages with automatic memory management become more popular, the limited availability of reference-counted types outside of GObject is becoming more of an issue. While adding reference counting to many of the types built into glib over the past several release cycles has definitely been a change for the better, in my opinion glib should make a stronger effort to facilitate creation and usage of reference counted types.
While GObject has a lot to offer, I think most everyone would agree that creating GObject-derived types in C can be a bit cumbersome in terms of the amount of (mostly boilerplate) code required. Furthermore, GObjects provide many features which are simply unnecessary for many users, and some of those features can add significant execution time.
Using the atomic functions provided by glib has, unfortunately, not proven to be very popular. There are examples of reference counted types outside of glib which are not derived from GObject, but they are rather few and far between.
What glib needs, in my opinion, is a generic reference counting API. Something which is light and easy to use.