Function

GLibslice_alloc

since: 2.10

Declaration

gpointer
g_slice_alloc (
  gsize block_size
)

Description

Allocates a block of memory from the slice allocator.

The block address handed out can be expected to be aligned to at least 1 * sizeof (void*), though in general slices are 2 * sizeof (void*) bytes aligned; if a malloc() fallback implementation is used instead, the alignment may be reduced in a libc dependent fashion.

Note that the underlying slice allocation mechanism can be changed with the [G_SLICE=always-malloc][G_SLICE] environment variable.

Available since: 2.10

Parameters

block_size

Type: gsize

The number of bytes to allocate.

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.