_d_allocmemory

Allocate memory using the garbage collector

DMD uses this to allocate closures:

void f(byte[24] x)
{
    return () => x; // `x` is on stack, must be moved to heap to keep it alive
}
extern (C)
void*
_d_allocmemory
(
size_t sz
)

Parameters

sz size_t

number of bytes to allocate

Return Value

Type: void*

pointer to sz bytes of free, uninitialized memory, managed by the GC.

Meta