The OpenD Programming Language

GC.malloc

Requests an aligned block of managed memory from the garbage collector. This memory may be deleted at will with a call to free, or it may be discarded and cleaned up automatically during a collection run. If allocation fails, this function will call onOutOfMemory which is expected to throw an OutOfMemoryError.

struct GC
version(D_ProfileGC)
extern (C) pragma(mangle, "gc_mallocTrace") static pure nothrow
void*
malloc
(
size_t sz
,
uint ba = 0
,
const scope TypeInfo ti = null
,
string file = __FILE__
,
int line = __LINE__
,
string func = __FUNCTION__
)

Parameters

sz size_t

The desired allocation size in bytes.

ba uint

A bitmask of the attributes to set on this block.

ti TypeInfo

TypeInfo to describe the memory. The GC might use this information to improve scanning for pointers or to call finalizers.

Return Value

Type: void*

A reference to the allocated memory or null if insufficient memory is available.

Throws

OutOfMemoryError on allocation failure.

Meta