authorgravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2026-08-07 21:42:18+02:00
committergravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2026-08-29 00:45:49+02:00
log13cc8a4de6cc26a225b6c9a49bd95d85275d1c66
treecb2547d0d4b8485e2a204b5ecd2982ad006e2a8c
parent81be5b22a34424972c6b75201c510f5159f5d4f3
signature Signed by SSH key SHA256:HYC3SjXQcAt6uwv9pu/6OoVQ2rUH8rb5zKiUHSe9uxk

Maker: always detect gpa leaks in debug mode

The build runner used to run in debug mode and had leaks so `--debug-maker-leaks` was needed to opt into reporting them. Since the leaks are now fixed in the maker which runs in release mode by default, `--debug-maker-leaks` becomes unnecessary in favor of just `ZIG_DEBUG_CMD`.

1 files changed, 2 insertions(+), 14 deletions(-)

lib/compiler/Maker.zig+2-14
......@@ -163,7 +163,6 @@ pub fn main(init: process.Init.Minimal) !void {
163163
164164 var arena_instance: std.heap.ArenaAllocator = .init(std.heap.page_allocator);
165165 defer arena_instance.deinit();
166 defer if (debugMakerLeaks()) log.debug("used {Bi} of arena", .{arena_instance.queryCapacity()});
167166 const arena = arena_instance.allocator();
168167
169168 const args = try init.args.toSlice(arena);
......@@ -444,8 +443,6 @@ pub fn main(init: process.Init.Minimal) !void {
444443 } else if (mem.cutPrefix(u8, arg, "--debug-rt=")) |rest| {
445444 graph.debug_compiler_runtime_libs = stringToEnum(std.lang.Optimize, rest) orelse
446445 fatal("unrecognized optimization mode: {s}", .{rest});
447 } else if (is_debug_mode and mem.eql(u8, arg, "--debug-maker-leaks")) {
448 debug_maker_leaks = true;
449446 } else if (mem.eql(u8, arg, "--libc-runtimes") or mem.eql(u8, arg, "--glibc-runtimes")) {
450447 // --glibc-runtimes was the old name of the flag; kept for compatibility for now.
451448 graph.libc_runtimes_dir = nextArgOrFatal(args, &arg_i);
......@@ -819,10 +816,7 @@ pub fn main(init: process.Init.Minimal) !void {
819816 .message => |payload| {
820817 const header: Client.Message.Header = try payload;
821818 switch (header.tag) {
822 .exit => {
823 cleanExit(io, &scanned_config);
824 process.exit(0);
825 },
819 .exit => return cleanExit(io, &scanned_config),
826820 .bsp_build_steps => {
827821 // Cancel existing file watching
828822 select.cancelDiscard();
......@@ -2550,8 +2544,7 @@ fn makeSteps(
25502544 break :code 2; // failure; do not print build command
25512545 };
25522546 if (code == 0) {
2553 removePoisonedConfiguration(io, maker.scanned_config);
2554 if (debugMakerLeaks()) return;
2547 return cleanExit(io, maker.scanned_config);
25552548 }
25562549 cleanup_task.await(io); // There is a defer above but an exit below.
25572550 _ = io.lockStderr(&.{}, graph.stderr_mode) catch {};
......@@ -3639,11 +3632,6 @@ fn removePoisonedConfiguration(io: Io, scanned_config: *const ScannedConfig) voi
36393632 }
36403633}
36413634
3642inline fn debugMakerLeaks() bool {
3643 if (!is_debug_mode) return false;
3644 return debug_maker_leaks;
3645}
3646
36473635const BuildRoot = struct {
36483636 directory: Cache.Directory,
36493637 close_directory: bool,