| ... | ... | @@ -30,7 +30,6 @@ |
| 30 | 30 | //! through the full set of freelists. |
| 31 | 31 | |
| 32 | 32 | const builtin = @import("builtin"); |
| 33 | | const native_os = builtin.os.tag; |
| 34 | 33 | |
| 35 | 34 | const std = @import("../std.zig"); |
| 36 | 35 | const assert = std.debug.assert; |
| ... | ... | @@ -56,11 +55,7 @@ var global: SmpAllocator = .{ |
| 56 | 55 | threadlocal var thread_id: Thread.Id = .none; |
| 57 | 56 | |
| 58 | 57 | const max_thread_count = 128; |
| 59 | | const slab_len: usize = @max(std.heap.page_size_max, switch (builtin.os.tag) { |
| 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 | | }); |
| 58 | const slab_len: usize = @max(std.heap.page_size_max, 256 * 1024); |
| 64 | 59 | /// Because of storing free list pointers, the minimum size class is 3. |
| 65 | 60 | const min_class = math.log2(math.ceilPowerOfTwoAssert(usize, 1 + @sizeOf(usize))); |
| 66 | 61 | const size_class_count = math.log2(slab_len) - min_class; |