| ... | @@ -30,7 +30,6 @@ | ... | @@ -30,7 +30,6 @@ |
| 30 | //! through the full set of freelists. | 30 | //! through the full set of freelists. |
| 31 | | 31 | |
| 32 | const builtin = @import("builtin"); | 32 | const builtin = @import("builtin"); |
| 33 | const native_os = builtin.os.tag; | | |
| 34 | | 33 | |
| 35 | const std = @import("../std.zig"); | 34 | const std = @import("../std.zig"); |
| 36 | const assert = std.debug.assert; | 35 | const assert = std.debug.assert; |
| ... | @@ -56,11 +55,7 @@ var global: SmpAllocator = .{ | ... | @@ -56,11 +55,7 @@ var global: SmpAllocator = .{ |
| 56 | threadlocal var thread_id: Thread.Id = .none; | 55 | threadlocal var thread_id: Thread.Id = .none; |
| 57 | | 56 | |
| 58 | const max_thread_count = 128; | 57 | const max_thread_count = 128; |
| 59 | const slab_len: usize = @max(std.heap.page_size_max, switch (builtin.os.tag) { | 58 | const slab_len: usize = @max(std.heap.page_size_max, 256 * 1024); |
| 60 | .windows => 64 * 1024, // Makes `std.heap.PageAllocator` take the happy path. | | |
| 61 | .wasi => 64 * 1024, // Max alignment supported by `std.heap.WasmAllocator`. | | |
| 62 | else => 256 * 1024, // Avoids too many active mappings when `page_size_max` is low. | | |
| 63 | }); | | |
| 64 | /// Because of storing free list pointers, the minimum size class is 3. | 59 | /// Because of storing free list pointers, the minimum size class is 3. |
| 65 | const min_class = math.log2(math.ceilPowerOfTwoAssert(usize, 1 + @sizeOf(usize))); | 60 | const min_class = math.log2(math.ceilPowerOfTwoAssert(usize, 1 + @sizeOf(usize))); |
| 66 | const size_class_count = math.log2(slab_len) - min_class; | 61 | const size_class_count = math.log2(slab_len) - min_class; |