How to accout max_rss precisely

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

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.

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:

```c
// a.c
int main() {}
```

It shows that `memory.peak` of this program is ~500KiB, which does not make sense to me.

I also wonder how to implement the same function under OS without cgroups, like BSD and macOS.

Thanks
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux