xmalloc

Uses pureMalloc to allocate a block of memory of the given size and throws an outOfMemoryError if the memory cannot be allocated.

pure nothrow @trusted @nogc
void[]
xmalloc
(
size_t size
)

Examples

t {

	ubyte[] bytes = cast(ubyte[])xmalloc(12);
	assert(bytes.length == 12);

	int[] ints = cast(int[])xmalloc(12);
	assert(ints.length == 3)

Meta