Zig 0.17.0-dev (Split by item)

Shortcut keys
?
Show these tips
S
Focus search field
Esc
Clear focus & close tips
U
Jump to source code
↑
Move up in search results
↓
Move down in search results
↵
Go to active search result
This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig standard library. Public Function

initCapacity

Public Function
std.heap.memory_pool.Extra.initCapacity
pub fn initCapacity(allocator: Allocator, num: usize) Allocator.Error!Pool

Creates a new memory pool and pre-allocates num items. This allows up to num active allocations before an OutOfMemory error might happen when calling create().

Params

File

heap/memory_pool.zig:63
63
64
65
66
67
68
        pub fn initCapacity(allocator: Allocator, num: usize) Allocator.Error!Pool {
            var pool: Pool = .empty;
            errdefer pool.deinit(allocator);
            try pool.addCapacity(allocator, num);
            return pool;
        }