+/**
+ * g_array_set_clear_func:
+ * @array: A #GArray
+ * @clear_func: a function to clear an element of @array
+ *
+ * Sets a function to clear an element of @array.
+ *
+ * The @clear_func will be called when an element in the array
+ * data segment is removed and when the array is freed and data
+ * segment is deallocated as well.
+ *
+ * Note that in contrast with other uses of #GDestroyNotify
+ * functions, @clear_func is expected to clear the contents of
+ * the array element it is given, but not free the element itself.
+ *
+ * Since: 2.32
+ */
+void
+g_array_set_clear_func (GArray *array,
+ GDestroyNotify clear_func)
+{
+ GRealArray *rarray = (GRealArray *) array;
+
+ g_return_if_fail (array != NULL);
+
+ rarray->clear_func = clear_func;
+}
+
+/**
+ * g_array_ref:
+ * @array: A #GArray
+ *
+ * Atomically increments the reference count of @array by one.
+ * This function is MT-safe and may be called from any thread.
+ *
+ * Returns: The passed in #GArray
+ *
+ * Since: 2.22
+ */
+GArray *
+g_array_ref (GArray *array)
+{
+ GRealArray *rarray = (GRealArray*) array;
+ g_return_val_if_fail (array, NULL);
+
+ g_atomic_int_inc (&rarray->ref_count);
+
+ return array;
+}
+
+typedef enum
+{
+ FREE_SEGMENT = 1 << 0,
+ PRESERVE_WRAPPER = 1 << 1
+} ArrayFreeFlags;
+
+static gchar *array_free (GRealArray *, ArrayFreeFlags);
+
+/**
+ * g_array_unref:
+ * @array: A #GArray
+ *
+ * Atomically decrements the reference count of @array by one. If the
+ * reference count drops to 0, all memory allocated by the array is
+ * released. This function is MT-safe and may be called from any
+ * thread.
+ *
+ * Since: 2.22
+ */
+void
+g_array_unref (GArray *array)
+{
+ GRealArray *rarray = (GRealArray*) array;
+ g_return_if_fail (array);
+
+ if (g_atomic_int_dec_and_test (&rarray->ref_count))
+ array_free (rarray, FREE_SEGMENT);
+}
+
+/**
+ * g_array_get_element_size:
+ * @array: A #GArray
+ *
+ * Gets the size of the elements in @array.
+ *
+ * Returns: Size of each element, in bytes
+ *
+ * Since: 2.22
+ */
+guint
+g_array_get_element_size (GArray *array)
+{
+ GRealArray *rarray = (GRealArray*) array;
+
+ g_return_val_if_fail (array, 0);
+
+ return rarray->elt_size;
+}
+
+/**
+ * g_array_free:
+ * @array: a #GArray
+ * @free_segment: if %TRUE the actual element data is freed as well
+ *
+ * Frees the memory allocated for the #GArray. If @free_segment is
+ * %TRUE it frees the memory block holding the elements as well and
+ * also each element if @array has a @element_free_func set. Pass
+ * %FALSE if you want to free the #GArray wrapper but preserve the
+ * underlying array for use elsewhere. If the reference count of @array
+ * is greater than one, the #GArray wrapper is preserved but the size
+ * of @array will be set to zero.
+ *
+ * If array elements contain dynamically-allocated memory, they should
+ * be freed separately.
+ *
+ * Returns: the element data if @free_segment is %FALSE, otherwise
+ * %NULL. The element data should be freed using g_free().
+ */