aboutsummaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-02-06 17:35:27 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-02-07 12:20:12 -0800
commit84bf7a6701d5f51a8307736d310d4049c9158921 (patch)
treea8a42cd57ae15cf60ed513cdaa4d603d2a9f5382 /lib/std
parent3d7c5cf64a3bbe55dfa943133d1a5a7a34fe388c (diff)
downloadzig-84bf7a6701d5f51a8307736d310d4049c9158921.tar.gz
zig-84bf7a6701d5f51a8307736d310d4049c9158921.zip
std.heap.SmpAllocator: 256K slab_len
and no need for special handling of wasi and windows since we don't ask for anything more than page-aligned.
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/heap/SmpAllocator.zig7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/std/heap/SmpAllocator.zig b/lib/std/heap/SmpAllocator.zig
index b1f2b14d0a..1a7eab2153 100644
--- a/lib/std/heap/SmpAllocator.zig
+++ b/lib/std/heap/SmpAllocator.zig
@@ -30,7 +30,6 @@
//! through the full set of freelists.
const builtin = @import("builtin");
-const native_os = builtin.os.tag;
const std = @import("../std.zig");
const assert = std.debug.assert;
@@ -56,11 +55,7 @@ var global: SmpAllocator = .{
threadlocal var thread_id: Thread.Id = .none;
const max_thread_count = 128;
-const slab_len: usize = @max(std.heap.page_size_max, switch (builtin.os.tag) {
- .windows => 64 * 1024, // Makes `std.heap.PageAllocator` take the happy path.
- .wasi => 64 * 1024, // Max alignment supported by `std.heap.WasmAllocator`.
- else => 256 * 1024, // Avoids too many active mappings when `page_size_max` is low.
-});
+const slab_len: usize = @max(std.heap.page_size_max, 256 * 1024);
/// Because of storing free list pointers, the minimum size class is 3.
const min_class = math.log2(math.ceilPowerOfTwoAssert(usize, 1 + @sizeOf(usize)));
const size_class_count = math.log2(slab_len) - min_class;