nix-rust / nix

Rust friendly bindings to *nix APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`ru_maxrss` in the result of `getrusage` is in bytes on macOS

hanwentao opened this issue · comments

According to the manpage of getrusage on macOS, ru_maxrss is in bytes, which contradicts the statement in nix's doc.

Quote from man getrusage on macOS:

ru_maxrss the maximum resident set size utilized (in bytes).

nix's doc on Usage:

The resident set size at its peak, in kilobytes.

Thanks for reporting this! This issue is interesting.

According to the manpage of getrusage on macOS, ru_maxrss is in bytes, which contradicts the statement in nix's doc.

The online man page, says it is in kilobytes. But a newer version of man pages (extracted from Xcode by a community user), says that it is in bytes.

I guess that Apple changed this interface in a specific version, a rough search leads me to this post, it seems that this change has been made for more than 4 years.