Skip to content

build runner: actually limit the peak RSS rather than enforcing it post-hoc #14953

@andrewrk

Description

@andrewrk

Extracted from #14647.

Currently, it is enforced post-hoc here:

zig/lib/std/Build/Step.zig

Lines 176 to 182 in b4d58e9

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}", .{
s.result_peak_rss, s.max_rss,
}) catch @panic("OOM");
s.result_error_msgs.append(arena, msg) catch @panic("OOM");
return error.MakeFailed;
}

Instead, this issue proposes to enforce it using operating system APIs.

I looked briefly into this, and it looked like a giant pain in the ass to do this, at least on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions