alignedAlloc

fun alignedAlloc(nBlocks: <Error class: unknown class>, nBlockBytes: <Error class: unknown class>, alignment: <Error class: unknown class>): <Error class: unknown class>?

This function is similar to g_malloc(), allocating (@n_blocks * @n_block_bytes) bytes, but care is taken to align the allocated memory to with the given alignment value. Additionally, it will detect possible overflow during multiplication.

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

Aligned memory allocations returned by this function can only be freed using g_aligned_free_sized() or g_aligned_free().

Return

the allocated memory

Since

2.72

Parameters

nBlocks

the number of blocks to allocate

nBlockBytes

the size of each block in bytes

alignment

the alignment to be enforced, which must be a positive power of 2 and a multiple of sizeof(void*)