Added maximum bytes allocated in debug allocator, as well as peak memory usage

This commit is contained in:
Alexandros Naskos
2020-06-09 16:39:00 +03:00
parent aa0e3e3736
commit c2f8537d7b
3 changed files with 30 additions and 4 deletions

View File

@@ -148,6 +148,13 @@ pub fn build(b: *std.build.Builder) !void {
b.option(bool, "allocation_info", "Enable use of debugging allocator and info logging.") orelse false,
);
const max_bytes_str = b.option([]const u8, "max_bytes_allocated", "Maximum amount of bytes to allocate before we exit. Zero for unlimited allocations. Only takes effect when allocation_info=true") orelse "0";
exe.addBuildOption(
usize,
"max_bytes_allocated",
try std.fmt.parseInt(usize, max_bytes_str, 10),
);
exe.addPackage(.{ .name = "known-folders", .path = "src/known-folders/known-folders.zig" });
exe.setTarget(target);