| ... | ... | @@ -532,7 +532,7 @@ pub fn main(init: process.Init.Minimal) !void { |
| 532 | 532 | } |
| 533 | 533 | |
| 534 | 534 | prepare(arena, builder, targets.items, &run, graph.random_seed) catch |err| switch (err) { |
| 535 | | error.DependencyLoopDetected => { |
| 535 | error.DependencyLoopDetected, error.InsufficientMemory => { |
| 536 | 536 | // Perhaps in the future there could be an Advanced Options flag |
| 537 | 537 | // such as --debug-build-runner-leaks which would make this code |
| 538 | 538 | // return instead of calling exit. |
| ... | ... | @@ -696,8 +696,8 @@ fn prepare( |
| 696 | 696 | for (0..step_names.len) |i| { |
| 697 | 697 | const step_name = step_names[step_names.len - i - 1]; |
| 698 | 698 | const s = b.top_level_steps.get(step_name) orelse { |
| 699 | | std.debug.print("no step named '{s}'\n access the help menu with 'zig build -h'\n", .{step_name}); |
| 700 | | process.exit(1); |
| 699 | std.log.info("access the help menu with \"zig build -h\"", .{}); |
| 700 | fatal("no step named '{s}'", .{step_name}); |
| 701 | 701 | }; |
| 702 | 702 | step_stack.putAssumeCapacity(&s.step, {}); |
| 703 | 703 | } |
| ... | ... | @@ -716,8 +716,10 @@ fn prepare( |
| 716 | 716 | { |
| 717 | 717 | // Check that we have enough memory to complete the build. |
| 718 | 718 | var any_problems = false; |
| 719 | var max_needed: usize = 0; |
| 719 | 720 | for (step_stack.keys()) |s| { |
| 720 | 721 | if (s.max_rss == 0) continue; |
| 722 | max_needed = @max(max_needed, s.max_rss); |
| 721 | 723 | if (s.max_rss > run.available_rss) { |
| 722 | 724 | if (run.skip_oom_steps) { |
| 723 | 725 | s.state = .skipped_oom; |
| ... | ... | @@ -725,7 +727,7 @@ fn prepare( |
| 725 | 727 | dependant.pending_deps -= 1; |
| 726 | 728 | } |
| 727 | 729 | } else { |
| 728 | | std.debug.print("{s}{s}: this step declares an upper bound of {d} bytes of memory, exceeding the available {d} bytes of memory\n", .{ |
| 730 | std.log.err("{s}{s}: this step declares an upper bound of {d} bytes of memory, exceeding the available {d} bytes of memory", .{ |
| 729 | 731 | s.owner.dep_prefix, s.name, s.max_rss, run.available_rss, |
| 730 | 732 | }); |
| 731 | 733 | any_problems = true; |
| ... | ... | @@ -734,8 +736,11 @@ fn prepare( |
| 734 | 736 | } |
| 735 | 737 | if (any_problems) { |
| 736 | 738 | if (run.max_rss_is_default) { |
| 737 | | std.debug.print("note: use --maxrss to override the default", .{}); |
| 739 | std.log.info("use --maxrss {d} to proceed, risking system memory exhaustion", .{ |
| 740 | max_needed, |
| 741 | }); |
| 738 | 742 | } |
| 743 | return error.InsufficientMemory; |
| 739 | 744 | } |
| 740 | 745 | } |
| 741 | 746 | } |