<div dir="ltr">Hi,<br><br>I'm working on a utility to report the maximum memory usage of a certain program. I intend to show the max_rss of this process and its children, but it's hard to use getrusage to get the RSS precisely, so I'm trying to leverage cgroups.<br><br>However on the document of cgroups v2, `memory.peak` says: The max memory usage recorded for the cgroup and its descendants since the creation of the cgroup. It didn't explain the composition of memory usage. So I want to ask that is the memory usage in `memory.peak` the maximum of RSS? I made a quick test on an empty program like:<br><br>```c<br>// a.c<br>int main() {}<br>```<br><br>It shows that `memory.peak` of this program is ~500KiB, which does not make sense to me.<br><br>I also wonder how to implement the same function under OS without cgroups, like BSD and macOS.<br><br>Thanks<br></div>