Constant page_allocator [src]

On operating systems that support memory mapping, this allocator makes a syscall directly for every allocation and free. Otherwise, it falls back to the preferred singleton for the target. Thread-safe.

Type

Allocator

Source

pub const page_allocator: Allocator = if (@hasDecl(root, "os") and @hasDecl(root.os, "heap") and @hasDecl(root.os.heap, "page_allocator")) root.os.heap.page_allocator else if (builtin.target.cpu.arch.isWasm()) .{ .ptr = undefined, .vtable = &WasmAllocator.vtable, } else if (builtin.target.os.tag == .plan9) .{ .ptr = undefined, .vtable = &SbrkAllocator(std.os.plan9.sbrk).vtable, } else .{ .ptr = undefined, .vtable = &PageAllocator.vtable, }