Function

GLibtry_malloc0

Declaration

gpointer
g_try_malloc0 (
  gsize n_bytes
)

Description

Attempts to allocate n_bytes, initialized to 0’s, and returns NULL on failure. Contrast with g_malloc0(), which aborts the program on failure.

Available since:2.8

Parameters

n_bytes gsize
 

Number of bytes to allocate.

Return value

Returns: gpointer
 

The allocated memory, or NULL.