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" {...@@ -1098,13 +1098,13 @@ test "small allocations - free in same order" {
1098 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1098 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1099 const allocator = gpa.allocator();1099 const allocator = gpa.allocator();
11001100
1101 var list = std.array_list.Managed(*u64).init(std.testing.allocator);1101 var list: std.ArrayList(*u64) = .empty;
1102 defer list.deinit();1102 defer list.deinit(std.testing.allocator);
11031103
1104 var i: usize = 0;1104 var i: usize = 0;
1105 while (i < 513) : (i += 1) {1105 while (i < 513) : (i += 1) {
1106 const ptr = try allocator.create(u64);1106 const ptr = try allocator.create(u64);
1107 try list.append(ptr);1107 try list.append(std.testing.allocator, ptr);
1108 }1108 }
11091109
1110 for (list.items) |ptr| {1110 for (list.items) |ptr| {
...@@ -1117,13 +1117,13 @@ test "small allocations - free in reverse order" {...@@ -1117,13 +1117,13 @@ test "small allocations - free in reverse order" {
1117 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");1117 defer std.testing.expect(gpa.deinit() == .ok) catch @panic("leak");
1118 const allocator = gpa.allocator();1118 const allocator = gpa.allocator();
11191119
1120 var list = std.array_list.Managed(*u64).init(std.testing.allocator);1120 var list: std.ArrayList(*u64) = .empty;
1121 defer list.deinit();1121 defer list.deinit(std.testing.allocator);
11221122
1123 var i: usize = 0;1123 var i: usize = 0;
1124 while (i < 513) : (i += 1) {1124 while (i < 513) : (i += 1) {
1125 const ptr = try allocator.create(u64);1125 const ptr = try allocator.create(u64);
1126 try list.append(ptr);1126 try list.append(std.testing.allocator, ptr);
1127 }1127 }
11281128
1129 while (list.pop()) |ptr| {1129 while (list.pop()) |ptr| {
...@@ -1281,9 +1281,9 @@ test "shrink large object to large object with larger alignment" {...@@ -1281,9 +1281,9 @@ test "shrink large object to large object with larger alignment" {
1281 // This loop allocates until we find a page that is not aligned to the big1281 // This loop allocates until we find a page that is not aligned to the big
1282 // alignment. Then we shrink the allocation after the loop, but increase the1282 // alignment. Then we shrink the allocation after the loop, but increase the
1283 // alignment to the higher one, that we know will force it to realloc.1283 // 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;
1285 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {1285 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
1286 try stuff_to_free.append(slice);1286 try stuff_to_free.append(debug_allocator, slice);
1287 slice = try allocator.alignedAlloc(u8, .@"16", alloc_size);1287 slice = try allocator.alignedAlloc(u8, .@"16", alloc_size);
1288 }1288 }
1289 while (stuff_to_free.pop()) |item| {1289 while (stuff_to_free.pop()) |item| {
...@@ -1344,9 +1344,9 @@ test "realloc large object to larger alignment" {...@@ -1344,9 +1344,9 @@ test "realloc large object to larger alignment" {
13441344
1345 const big_alignment: usize = default_page_size * 2;1345 const big_alignment: usize = default_page_size * 2;
1346 // This loop allocates until we find a page that is not aligned to the big alignment.1346 // 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;
1348 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {1348 while (mem.isAligned(@intFromPtr(slice.ptr), big_alignment)) {
1349 try stuff_to_free.append(slice);1349 try stuff_to_free.append(debug_allocator, slice);
1350 slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50);1350 slice = try allocator.alignedAlloc(u8, .@"16", default_page_size * 2 + 50);
1351 }1351 }
1352 while (stuff_to_free.pop()) |item| {1352 while (stuff_to_free.pop()) |item| {