allocate

Allocates enough memory for a given number of elements of a certain type.

The allocated memory must be later deallocated if one wishes to avoid leaks. It will also be registered for GC scanning in case this is compiled in a GC-enabled mode (not betterC).

  1. T[] allocate(size_t n)
  2. T* allocate()
    @nogc nothrow @trusted
    T*
    allocate
    (
    T
    )
    ()

Return Value

Type: T*

Allocated memory block (null in case of OOM, overflow or zero-sized allocation).

Meta

Version

XXX: It would have been nice to parameterize this by global structs following the same duck-typed interface of the core std.experimental allocators, but they don't seem to be linked in when compiling in betterC mode.