authorgravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-08-15 10:29:27+01:00
committergravatar for mlugg@mlugg.co.ukMatthew Lugg <mlugg@mlugg.co.uk> 2025-08-15 23:03:16+01:00
logd835a6ba9ac11773f8ae1c3b2c5e9241cf875ee9
tree53d18c679a96318f10163fb0dd0805cca97b12f7
parentf758b97bfd5e28e4ff1c8d9eca34de9b22990f85

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.

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

lib/std/Build/Step.zig+1-1
......@@ -271,7 +271,7 @@ pub fn make(s: *Step, options: MakeOptions) error{ MakeFailed, MakeSkipped }!voi
271271 }
272272
273273 if (s.max_rss != 0 and s.result_peak_rss > s.max_rss) {
274 const msg = std.fmt.allocPrint(arena, "memory usage peaked at {d} bytes, exceeding the declared upper bound of {d}", .{
274 const msg = std.fmt.allocPrint(arena, "memory usage peaked at {0B:.2} ({0d} bytes), exceeding the declared upper bound of {1B:.2} ({1d} bytes)", .{
275275 s.result_peak_rss, s.max_rss,
276276 }) catch @panic("OOM");
277277 s.result_error_msgs.append(arena, msg) catch @panic("OOM");