From d835a6ba9ac11773f8ae1c3b2c5e9241cf875ee9 Mon Sep 17 00:00:00 2001 From: mlugg Date: Fri, 15 Aug 2025 10:29:27 +0100 Subject: [PATCH] std.Build: improve error for peak RSS exceeding declared value As well as the exact byte count, include a human-readable value so it's clearer what the error is actually telling you. The exact byte count might not be worth keeping, but I decided I would in case it's useful in any scenario. --- lib/std/Build/Step.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/Build/Step.zig b/lib/std/Build/Step.zig index c3392c4301..3002db628f 100644 --- a/lib/std/Build/Step.zig +++ b/lib/std/Build/Step.zig @@ -271,7 +271,7 @@ pub fn make(s: *Step, options: MakeOptions) error{ MakeFailed, MakeSkipped }!voi } if (s.max_rss != 0 and s.result_peak_rss > s.max_rss) { - const msg = std.fmt.allocPrint(arena, "memory usage peaked at {d} bytes, exceeding the declared upper bound of {d}", .{ + const msg = std.fmt.allocPrint(arena, "memory usage peaked at {0B:.2} ({0d} bytes), exceeding the declared upper bound of {1B:.2} ({1d} bytes)", .{ s.result_peak_rss, s.max_rss, }) catch @panic("OOM"); s.result_error_msgs.append(arena, msg) catch @panic("OOM");