mallocN

This function is similar to glib.global.gmalloc, allocating (n_blocks * n_block_bytes) bytes, but care is taken to detect possible overflow during multiplication.

If the allocation fails (because the system is out of memory), the program is terminated.

void*
mallocN
(
size_t nBlocks
,)

Parameters

nBlocks size_t

the number of blocks to allocate

nBlockBytes size_t

the size of each block in bytes

Return Value

Type: void*

a pointer to the allocated memory