From 969db474f3aa273dec52b5e14a934f62b7eda89c Mon Sep 17 00:00:00 2001 From: Masa Bence Date: Mon, 19 Oct 2026 22:49:49 +0200 Subject: [PATCH] update Arraylist in `debug_allocator.zig` to unmanaged --- lib/std/heap/debug_allocator.zig | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/std/heap/debug_allocator.zig b/lib/std/heap/debug_allocator.zig index ccba352bb55e0e12bfd596d3a1f49458407a1c98..28f0e4c9b654bf6d5a35673271e5eab459487f40 100644 --- a/lib/std/heap/debug_allocator.zig +++ b/lib/std/heap/debug_allocator.zig @@ -1098,13 +1098,13 @@ test "small allocations - free in same order" { defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); const allocator = gpa.allocator(); - var list = std.array_list.Managed(*u64).init(std.testing.allocator); - defer list.deinit(); + var list: std.ArrayList(*u64) = .empty; + defer list.deinit(std.testing.allocator); var i: usize = 0; while (i < 513) : (i += 1) { const ptr = try allocator.create(u64); - try list.append(ptr); + try list.append(std.testing.allocator, ptr); } for (list.items) |ptr| { @@ -1117,13 +1117,13 @@ test "small allocations - free in reverse order" { defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak"); const allocator = gpa.allocator(); - var list = std.array_list.Managed(*u64).init(std.testing.allocator); - defer list.deinit(); + var list: std.ArrayList(*u64) = .empty; + defer list.deinit(std.testing.allocator); var i: usize = 0; while (i < 513) : (i += 1) { const ptr = try allocator.create(u64); - try list.append(ptr); + try list.append(std.testing.allocator, ptr); } while (list.pop()) |ptr| { @@ -1281,9 +1281,9 @@ test "shrink large object to large object with larger alignment" { // 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. - var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator); + var stuff_to_free: std.ArrayList([]align(16) u8) = .empty; while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { - try stuff_to_free.append(slice); + try stuff_to_free.append(debug_allocator, slice); slice = try allocator.alignedAlloc(u8, .@"16", alloc_size); } while (stuff_to_free.pop()) |item| { @@ -1344,9 +1344,9 @@ test "realloc large object to larger alignment" { 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.array_list.Managed([]align(16) u8).init(debug_allocator); + var stuff_to_free: std.ArrayList([]align(16) u8) = .empty; while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) { - try stuff_to_free.append(slice); + try stuff_to_free.append(debug_allocator, slice); slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50); } while (stuff_to_free.pop()) |item| { -- 2.54.0