### Function

# GLib realloc

#### Declaration [src]

    gpointer
    g_realloc (
      gpointer mem,
      gsize n_bytes
    )

#### Description [src]

Reallocates the memory pointed to by `mem`, so that it now has space for `n_bytes` bytes of memory. It returns the new address of the memory, which may have been moved. `mem` may be `NULL`, in which case it’s considered to have zero-length. `n_bytes` may be 0, in which case `NULL` will be returned and `mem` will be freed unless it is `NULL`.

If the allocation fails (because the system is out of memory), the program is terminated.

#### Parameters

`mem`

  Type: `gpointer`

  The memory to reallocate.

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

`n_bytes`

  Type: `gsize`

  New size of the memory in bytes.

#### Return value

Type: `gpointer`

The new address of the allocated memory.

The data is owned by the called function.
The return value can be `NULL`.