From d0e1a6a23de8620a42829a95343b297cefc1c7a4 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 5 Feb 2025 20:23:21 -0800 Subject: [PATCH] std.heap.DebugAllocator: update unit tests for new impl No longer need this windows-specific behavior. --- lib/std/heap/debug_allocator.zig | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/std/heap/debug_allocator.zig b/lib/std/heap/debug_allocator.zig index a4ac906703..8abf6133bf 100644 --- a/lib/std/heap/debug_allocator.zig +++ b/lib/std/heap/debug_allocator.zig @@ -1220,10 +1220,7 @@ test "shrink large object to large object with larger alignment" { var slice = try allocator.alignedAlloc(u8, 16, alloc_size); defer allocator.free(slice); - const big_alignment: usize = switch (builtin.os.tag) { - .windows => default_page_size * 32, // Windows aligns to 64K. - else => default_page_size * 2, - }; + const big_alignment: usize = default_page_size * 2; // This loop allocates until we find a page that is not aligned to the big // alignment. Then we shrink the allocation after the loop, but increase the // alignment to the higher one, that we know will force it to realloc. @@ -1297,10 +1294,7 @@ test "realloc large object to larger alignment" { var slice = try allocator.alignedAlloc(u8, 16, default_page_size * 2 + 50); defer allocator.free(slice); - const big_alignment: usize = switch (builtin.os.tag) { - .windows => default_page_size * 32, // Windows aligns to 64K. - else => default_page_size * 2, - }; + const big_alignment: usize = default_page_size * 2; // This loop allocates until we find a page that is not aligned to the big alignment. var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {