authorgravatar for bence.masa@gmail.comMasa Bence <bence.masa@gmail.com> 2026-10-19 22:49:49+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-21 19:21:18+02:00
log969db474f3aa273dec52b5e14a934f62b7eda89c
treed358dbb9d6739ff9824252f53a7228f53620c504
parentd8a597b56ab34dcc791689509a626138ba93d755

update Arraylist in `debug_allocator.zig` to unmanaged


1 files changed, 10 insertions(+), 10 deletions(-)

lib/std/heap/debug_allocator.zig+10-10
......@@ -1098,13 +1098,13 @@ test "small allocations - free in same order" {
10981098 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
10991099 const allocator = gpa.allocator();
11001100
1101 var list = std.array_list.Managed(*u64).init(std.testing.allocator);
1102 defer list.deinit();
1101 var list: std.ArrayList(*u64) = .empty;
1102 defer list.deinit(std.testing.allocator);
11031103
11041104 var i: usize = 0;
11051105 while (i < 513) : (i += 1) {
11061106 const ptr = try allocator.create(u64);
1107 try list.append(ptr);
1107 try list.append(std.testing.allocator, ptr);
11081108 }
11091109
11101110 for (list.items) |ptr| {
......@@ -1117,13 +1117,13 @@ test "small allocations - free in reverse order" {
11171117 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
11181118 const allocator = gpa.allocator();
11191119
1120 var list = std.array_list.Managed(*u64).init(std.testing.allocator);
1121 defer list.deinit();
1120 var list: std.ArrayList(*u64) = .empty;
1121 defer list.deinit(std.testing.allocator);
11221122
11231123 var i: usize = 0;
11241124 while (i < 513) : (i += 1) {
11251125 const ptr = try allocator.create(u64);
1126 try list.append(ptr);
1126 try list.append(std.testing.allocator, ptr);
11271127 }
11281128
11291129 while (list.pop()) |ptr| {
......@@ -1281,9 +1281,9 @@ test "shrink large object to large object with larger alignment" {
12811281 // This loop allocates until we find a page that is not aligned to the big
12821282 // alignment. Then we shrink the allocation after the loop, but increase the
12831283 // alignment to the higher one, that we know will force it to realloc.
1284 var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator);
1284 var stuff_to_free: std.ArrayList([]align(16) u8) = .empty;
12851285 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
1286 try stuff_to_free.append(slice);
1286 try stuff_to_free.append(debug_allocator, slice);
12871287 slice = try allocator.alignedAlloc(u8, .@"16", alloc_size);
12881288 }
12891289 while (stuff_to_free.pop()) |item| {
......@@ -1344,9 +1344,9 @@ test "realloc large object to larger alignment" {
13441344
13451345 const big_alignment: usize = default_page_size * 2;
13461346 // This loop allocates until we find a page that is not aligned to the big alignment.
1347 var stuff_to_free = std.array_list.Managed([]align(16) u8).init(debug_allocator);
1347 var stuff_to_free: std.ArrayList([]align(16) u8) = .empty;
13481348 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
1349 try stuff_to_free.append(slice);
1349 try stuff_to_free.append(debug_allocator, slice);
13501350 slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50);
13511351 }
13521352 while (stuff_to_free.pop()) |item| {