### Function

# GLib try_realloc

#### Declaration

    gpointer
    g_try_realloc (
      gpointer mem,
      gsize n_bytes
    )

#### Description

Attempts to realloc `mem` to a new size, `n_bytes`, and returns `NULL` on failure. Contrast with g_realloc(), which aborts the program on failure.

If `mem` is `NULL`, behaves the same as g_try_malloc().

#### Parameters

`mem`

  Type: `gpointer`

  Previously-allocated memory, or `NULL`.

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

`n_bytes`

  Type: `gsize`

  Number of bytes to allocate.

#### Return value

Type: `gpointer`

The allocated memory, or `NULL`.

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