### Function

# GLib PtrArray set_free_func

since: 2.22

#### Declaration [src]

    void
    g_ptr_array_set_free_func (
      GPtrArray* array,
      GDestroyNotify element_free_func
    )

#### Description [src]

Sets a function for freeing each element when `array` is destroyed either via g_ptr_array_unref(), when `g_ptr_array_free()` is called with `free_segment` set to `TRUE` or when removing elements.

Available since: 2.22

This function is not directly available to language bindings.

#### Parameters

`array`

  Type: An array of `gpointer`

  A `GPtrArray`.

  The data is owned by the caller of the function.

`element_free_func`

  Type: `GDestroyNotify`

  A function to free elements with destroy `array` or `NULL`.