### Struct

# GLib MemVTable

since: 2.0

#### Description

    struct GMemVTable {
      gpointer (* malloc) (
        gsize n_bytes
      );
      gpointer (* realloc) (
        gpointer mem,
        gsize n_bytes
      );
      void (* free) (
        gpointer mem
      );
      gpointer (* calloc) (
        gsize n_blocks,
        gsize n_block_bytes
      );
      gpointer (* try_malloc) (
        gsize n_bytes
      );
      gpointer (* try_realloc) (
        gpointer mem,
        gsize n_bytes
      );
    }

A set of functions used to perform memory allocation. The same `GMemVTable` must be used for all allocations in the same program; a call to g_mem_set_vtable(), if it exists, should be prior to any use of GLib.

This functions related to this has been deprecated in 2.46, and no longer work.

###### Structure members

`malloc`

  Function to use for allocating memory.

`realloc`

  Function to use for reallocating memory.

`free`

  Function to use to free memory.

`calloc`

  Function to use for allocating zero-filled memory.

`try_malloc`

  Function to use for allocating memory without a default error handler.

`try_realloc`

  Function to use for reallocating memory without a default error handler.

Available since: 2.0