Add refcounted data
commitc5d2417d07d055e6b91f2573a1a0237b60475393
authorEmmanuele Bassi <ebassi@gnome.org>
Sun, 10 Jun 2018 11:20:34 +0000 (10 12:20 +0100)
committerEmmanuele Bassi <ebassi@gnome.org>
Mon, 9 Jul 2018 09:11:42 +0000 (9 10:11 +0100)
treea9fae5e8f8402d1890d77dd94f6a6bbf822ba746
parent884c4f4eb657d160581a330b8b4864c22d9d2099
Add refcounted data

It is useful to provide a "reference counted allocation" API that can
add reference counting semantics to any memory allocation. This allows
turning data structures that usually are placed on the stack into memory
that can be placed on the heap without:

 - adding a public reference count field
 - implementing copy/free semantics

This mechanism is similar to Rust's Rc<Box<T>> combination of traits,
and uses a Valgrind-friendly overallocation mechanism to store the
reference count into a private data segment, like we do with GObject's
private instance data.
docs/reference/glib/glib-docs.xml
docs/reference/glib/glib-sections.txt
glib/Makefile.am
glib/glib.h
glib/grcbox.c [new file with mode: 0644]
glib/grcbox.h [new file with mode: 0644]
glib/meson.build
glib/tests/Makefile.am
glib/tests/meson.build
glib/tests/rcbox.c [new file with mode: 0644]