| ... | @@ -1220,10 +1220,7 @@ test "shrink large object to large object with larger alignment" { | ... | @@ -1220,10 +1220,7 @@ test "shrink large object to large object with larger alignment" { |
| 1220 | var slice = try allocator.alignedAlloc(u8, 16, alloc_size); | 1220 | var slice = try allocator.alignedAlloc(u8, 16, alloc_size); |
| 1221 | defer allocator.free(slice); | 1221 | defer allocator.free(slice); |
| 1222 | | 1222 | |
| 1223 | const big_alignment: usize = switch (builtin.os.tag) { | 1223 | const big_alignment: usize = default_page_size * 2; |
| 1224 | .windows => default_page_size * 32, // Windows aligns to 64K. | | |
| 1225 | else => default_page_size * 2, | | |
| 1226 | }; | | |
| 1227 | // This loop allocates until we find a page that is not aligned to the big | 1224 | // This loop allocates until we find a page that is not aligned to the big |
| 1228 | // alignment. Then we shrink the allocation after the loop, but increase the | 1225 | // alignment. Then we shrink the allocation after the loop, but increase the |
| 1229 | // alignment to the higher one, that we know will force it to realloc. | 1226 | // alignment to the higher one, that we know will force it to realloc. |
| ... | @@ -1297,10 +1294,7 @@ test "realloc large object to larger alignment" { | ... | @@ -1297,10 +1294,7 @@ test "realloc large object to larger alignment" { |
| 1297 | var slice = try allocator.alignedAlloc(u8, 16, default_page_size * 2 + 50); | 1294 | var slice = try allocator.alignedAlloc(u8, 16, default_page_size * 2 + 50); |
| 1298 | defer allocator.free(slice); | 1295 | defer allocator.free(slice); |
| 1299 | | 1296 | |
| 1300 | const big_alignment: usize = switch (builtin.os.tag) { | 1297 | const big_alignment: usize = default_page_size * 2; |
| 1301 | .windows => default_page_size * 32, // Windows aligns to 64K. | | |
| 1302 | else => default_page_size * 2, | | |
| 1303 | }; | | |
| 1304 | // This loop allocates until we find a page that is not aligned to the big alignment. | 1298 | // This loop allocates until we find a page that is not aligned to the big alignment. |
| 1305 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); | 1299 | var stuff_to_free = std.ArrayList([]align(16) u8).init(debug_allocator); |
| 1306 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { | 1300 | while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { |