Skip to content

support G, M, GiB, MiB, GB, MB, etc. shorthands in --maxrss arg #14955

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Tracked by #14647
andrewrk opened this issue Mar 17, 2023 · 1 comment · Fixed by #14976
Closed
Tracked by #14647

support G, M, GiB, MiB, GB, MB, etc. shorthands in --maxrss arg #14955

andrewrk opened this issue Mar 17, 2023 · 1 comment · Fixed by #14976
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@andrewrk
Copy link
Member

Extracted from #14647.

zig/lib/build_runner.zig

Lines 149 to 160 in b4d58e9

} else if (mem.eql(u8, arg, "--maxrss")) {
const max_rss_text = nextArg(args, &arg_idx) orelse {
std.debug.print("Expected argument after --sysroot\n\n", .{});
usageAndErr(builder, false, stderr_stream);
};
// TODO: support shorthand such as "2GiB", "2GB", or "2G"
max_rss = std.fmt.parseInt(usize, max_rss_text, 10) catch |err| {
std.debug.print("invalid byte size: '{s}': {s}\n", .{
max_rss_text, @errorName(err),
});
process.exit(1);
};

\\ --maxrss <bytes> Limit memory usage (default is to use available memory)

@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Mar 17, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Mar 17, 2023
@ghost
Copy link

ghost commented Mar 17, 2023

I am currently testing a commit for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant