GLib.slice_copy
Description: Reference for GLib.slice_copy

### Function

# GLibslice_copy

since: 2.14

#### Declaration

    gpointer
    g_slice_copy (
      gsize block_size,
      gconstpointer mem_block
    )

#### Description

Allocates a block of memory from the slice allocator and copies `block_size` bytes into it from `mem_block`.

`mem_block` must be non-`NULL` if `block_size` is non-zero.

Since GLib 2.76 this always uses the system `malloc()` implementation internally.

Available since: 2.14

#### Parameters

`block_size`

  Type: `gsize`

  The number of bytes to allocate.

`mem_block`

  Type: `gconstpointer`

  The memory to copy.

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

#### Return value

Type: `gpointer`

A pointer to the allocated memory block, which will be `NULL` if and only if `mem_size` is 0

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