### Function

# GLib free

since: 2.0

#### Declaration

    void
    g_free (
      gpointer mem
    )

#### Description

Frees the memory pointed to by `mem`.

If you know the allocated size of `mem`, calling `g_free_sized()` may be faster, depending on the libc implementation in use.

Starting from GLib 2.78, this may happen automatically in case a GCC compatible compiler is used with some optimization level and the allocated size is known at compile time (see documentation of `__builtin_object_size()` to understand its caveats).

If `mem` is `NULL` it simply returns, so there is no need to check `mem` against `NULL` before calling this function.

Available since: 2.0

#### Parameters

`mem`

  Type: `gpointer`

  The memory to free.

  The argument can be `NULL`.
  The data is owned by the caller of the function.