### Function

# Vips malloc

#### Declaration [src]

    void*
    vips_malloc (
      VipsObject* object,
      size_t size
    )

#### Description [src]

`g_malloc()` local to `object`, that is, the memory will be automatically freed for you when the object is closed. If `object` is `NULL`, you need to free the memory explicitly with `g_free()`.

This function cannot fail. See `vips_tracked_malloc()` if you are allocating large amounts of memory.

See also

`vips_tracked_malloc()`.

#### Parameters

`object`

  Type: `VipsObject`

  Allocate memory local to this `VipsObject`, or `NULL`.

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

`size`

  Type: `size_t`

  Number of bytes to allocate.

#### Return value

Type: `void*`

A pointer to the allocated memory.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.