authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-01 18:00:12-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-01-04 00:27:08-08:00
log0362d9f3215e36dd12b5ba47bca8a9cd107b1697
tree372bc50f37e1b522d2974d812f9bcd6e2c3a2900
parent60447ea97cd86e38e566c23d40c123e19d50eb1a

start: make leaks into warnings

I think it will be less confusing if memory leak checking doesn't change the return code of the process.

1 files changed, 4 insertions(+), 5 deletions(-)

lib/std/start.zig+4-5
......@@ -669,17 +669,16 @@ inline fn callMain(args: std.process.Args.Vector, environ: std.process.Environ.B
669669 else
670670 std.heap.smp_allocator;
671671
672 defer if (use_debug_allocator) switch (debug_allocator.deinit()) {
673 .leak => std.process.exit(1),
674 .ok => {},
672 defer if (use_debug_allocator) {
673 _ = debug_allocator.deinit(); // Leaks do not affect return code.
675674 };
676675
677676 var arena_allocator = std.heap.ArenaAllocator.init(std.heap.page_allocator);
678677 defer arena_allocator.deinit();
679678
680679 var threaded: std.Io.Threaded = .init(gpa, .{
681 .argv0 = .init(.{ .value = args }),
682 .environ = .{ .process_environ = .{ .block = environ } },
680 .argv0 = .init(.{ .vector = args }),
681 .environ = .{ .block = environ },
683682 });
684683 defer threaded.deinit();
685684