GLib.PtrArray.new_with_free_func
Description: Reference for GLib.PtrArray.new_with_free_func

### Function

# GLib PtrArraynew_with_free_func

since: 2.22

#### Declaration [src]

    GPtrArray*
    g_ptr_array_new_with_free_func (
      GDestroyNotify element_free_func
    )

#### Description [src]

Creates a new `GPtrArray` with a reference count of 1 and use `element_free_func` for freeing each element when the 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

`element_free_func`

  Type: `GDestroyNotify`

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

#### Return value

Type: An array of `gpointer`

A new `GPtrArray`.

The caller of the function takes ownership of the data, and is responsible for freeing it.