Function

GLibArrayfree

Declaration

gchar*
g_array_free (
  GArray* array,
  gboolean free_segment
)

Description

Frees the memory allocated for the GArray. If free_segment is TRUE it frees the memory block holding the elements as well. 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 contents point to dynamically-allocated memory, they should be freed separately if free_seg is TRUE and no clear_func function has been set for array.

This function is not thread-safe. If using a GArray from multiple threads, use only the atomic g_array_ref() and g_array_unref() functions.

This function is not directly available to language bindings.

Parameters

array

Type: An array of gpointer

A GArray.

The data is owned by the caller of the function.
free_segment

Type: gboolean

If TRUE the actual element data is freed as well.

Return value

Type: gchar*

The element data if free_segment is FALSE, otherwise NULL. The element data should be freed using g_free().

The caller of the function takes ownership of the data, and is responsible for freeing it.
The value is a NUL terminated UTF-8 string.