alignedAlloc

Allocate array using strict memory alignment.

Uses std.experimental.allocator.mallocator.AlignmedMallocator to allocate memory.

@nogc @trusted
T[]
alignedAlloc
(
T
)
(
size_t count
,
uint alignment = 16
)

Parameters

count
Type: size_t

Count of elements to be allocated for the array.

alignment
Type: uint

size in bytes for memory alignment pattern.

Return Value

Type: T[]

Dynamic array of type T, with lenght of given count, aligned using given alignment size.

note: Dynamic array is not added to GC, so it has to be destoyed explicitly using alignedFree. If GC is needed, use alignedAllocGC.

Meta