DoxigAlpha

getMaxRss

Returns the peak resident set size of the child process, in bytes, if available.

Function parameters

Parameters

#

Type definitions in this namespace

Types

#
StdIo
Behavior of the child process's standard input, output, and error
WindowsExtension
File name extensions supported natively by `CreateProcess()` on Windows.

First argument in argv is the executable.

Functions

#
init
First argument in argv is the executable.
spawn
On success must call `kill` or `wait`.
kill
Forcibly terminates child process and then cleans up all resources.
waitForSpawn
On some targets, `spawn` may not report all spawn errors, such as `error.InvalidExe`.
wait
Blocks until child process terminates and then cleans up all resources.
collectOutput
Collect the output from the process's stdout and stderr.
run
Spawns a child process, waits for it, collecting stdout and stderr, and then returns.

Error sets in this namespace

Error Sets

#

Source

Implementation

#
pub inline fn getMaxRss(rus: ResourceUsageStatistics) ?usize {
    switch (native_os) {
        .linux => {
            if (rus.rusage) |ru| {
                return @as(usize, @intCast(ru.maxrss)) * 1024;
            } else {
                return null;
            }
        },
        .windows => {
            if (rus.rusage) |ru| {
                return ru.PeakWorkingSetSize;
            } else {
                return null;
            }
        },
        .macos, .ios => {
            if (rus.rusage) |ru| {
                // Darwin oddly reports in bytes instead of kilobytes.
                return @as(usize, @intCast(ru.maxrss));
            } else {
                return null;
            }
        },
        else => return null,
    }
}