allocAligned

fnT[] allocAligned(T)(size_t count) @trusted pure nothrow

Allocates a zeroed, BUFFER_ALIGNMENT-aligned, GC-owned buffer of count elements of T.

The block is over-allocated by BUFFER_ALIGNMENT bytes and the aligned interior slice returned; the block base pointer is dropped, which is safe because the GC traces interior pointers (fact 3). The block is allocated with BlkAttr.NO_SCAN when T has no indirections, so numeric data is never scanned by the collector. Externally owned memory (mmap, FFI) may be wrapped zero-copy under the caller lifetime contract of ../ddn/doc/DDN-NATIVE-ARRAYS.md D3 instead of going through this helper.

Parameters

Tthe element type the buffer will be used as
countnumber of elements to allocate

Returns

a mutable, zeroed, 64-byte-aligned slice of exactly count

elements, owned by the GC.