Function alloc [src]

Allocates an array of n items of type T and sets all the items to undefined. Depending on the Allocator implementation, it may be required to call free once the memory is no longer needed, to avoid a resource leak. If the Allocator implementation is unknown, then correct code will call free when done. For allocating a single item, see create.

Prototype

pub fn alloc(self: Allocator, comptime T: type, n: usize) Error![]T

Parameters

self: AllocatorT: typen: usize

Possible Errors

OutOfMemory

Source

pub fn alloc(self: Allocator, comptime T: type, n: usize) Error![]T { return self.allocAdvancedWithRetAddr(T, null, n, @returnAddress()); }