In Linux, the kernel exposes various per-process memory counters through /proc/[pid]/statm including
- total program size
- resident set size
- shared pages
- text (code)
- data/stack
- library
- dirty pages
What is the equivalent of such thing in Mac OS (and iOS)? I am aware of the sysctl interface, but it does not appear to provide the equivalent information.
I have looked at the "top" output (invoked by non-root user) on Mac OS and it contains things like
- RPRVT - amount of resident memory consumed by our heap allocations
- RSHRD - amount of resident shared memory (shared libraries)
- RSIZE - ~equals RPRVT + RSHRD
- VSIZE - the total amount of memory consumed by the process (resident and paged mem combined)
I wonder where such information is retrieved. Are there any additional counters (similar to the Linux ones) that are not displayed by top.
What about iOS?
EDIT: note that I'm looking for the per-process memory usage counter (not global system ones)
Thanks!