Skip to content

Commit 755a3d9

Browse files
authored
langref: convert to unmanaged ArrayList in example
1 parent e5c2df9 commit 755a3d9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/langref/testing_detect_leak.zig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
const std = @import("std");
22

33
test "detect leak" {
4-
var list = std.array_list.Managed(u21).init(std.testing.allocator);
5-
// missing `defer list.deinit();`
6-
try list.append('☔');
4+
const gpa = std.testing.allocator;
5+
var list: std.ArrayList(u21) = .empty;
6+
// missing `defer list.deinit(gpa);`
7+
try list.append(gpa, '☔');
78

89
try std.testing.expect(list.items.len == 1);
910
}

0 commit comments

Comments
 (0)