mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
std.heap.DebugAllocator: default wasm to 64K page size
including on freestanding
This commit is contained in:
parent
dd54c48aa2
commit
8683f25d24
@ -90,11 +90,16 @@ const mem = std.mem;
|
|||||||
const Allocator = std.mem.Allocator;
|
const Allocator = std.mem.Allocator;
|
||||||
const StackTrace = std.builtin.StackTrace;
|
const StackTrace = std.builtin.StackTrace;
|
||||||
|
|
||||||
const default_page_size: usize = @max(std.heap.page_size_max, switch (builtin.os.tag) {
|
const default_page_size: usize = switch (builtin.os.tag) {
|
||||||
.windows => 64 * 1024, // Makes `std.heap.PageAllocator` take the happy path.
|
// Makes `std.heap.PageAllocator` take the happy path.
|
||||||
.wasi => 64 * 1024, // Max alignment supported by `std.heap.WasmAllocator`.
|
.windows => 64 * 1024,
|
||||||
else => 128 * 1024, // Avoids too many active mappings when `page_size_max` is low.
|
else => switch (builtin.cpu.arch) {
|
||||||
});
|
// Max alignment supported by `std.heap.WasmAllocator`.
|
||||||
|
.wasm32, .wasm64 => 64 * 1024,
|
||||||
|
// Avoids too many active mappings when `page_size_max` is low.
|
||||||
|
else => @max(std.heap.page_size_max, 128 * 1024),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const Log2USize = std.math.Log2Int(usize);
|
const Log2USize = std.math.Log2Int(usize);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user