### Function Macro

# GLib slice_dup

since: 2.14

#### Declaration

    #define g_slice_dup (
      type,
      mem
    )

#### Description

A convenience macro to duplicate a block of memory using the slice allocator.

It calls `g_slice_copy()` with `sizeof (`type`)` and casts the returned pointer to a pointer of the given type, avoiding a type cast in the source code.

This can never return `NULL`.

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

Available since: 2.14

This function is not directly available to language bindings.

#### Parameters

`type`

  Type: `-`

  The type to duplicate, typically a structure name.

`mem`

  Type: `-`

  The memory to copy into the allocated block.