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()) .
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.
339 340 341 342 343 344 345 346 347 348 349
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 .{ .ptr = undefined, .vtable = &PageAllocator.vtable, }
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.