Memory usage of current process in C

后端 未结 7 1465
深忆病人
深忆病人 2020-12-01 04:22

I need to get the memory usage of the current process in C. Can someone offer a code sample of how to do this on a Linux platform?

I\'m aware of the cat /proc/

相关标签:
7条回答
  • 2020-12-01 05:14

    The above struct was taken from 4.3BSD Reno. Not all fields are mean- ingful under Linux. In linux 2.4 only the fields ru_utime, ru_stime, ru_minflt, and ru_majflt are maintained. Since Linux 2.6, ru_nvcsw and ru_nivcsw are also maintained.

    http://www.atarininja.org/index.py/tags/code

    0 讨论(0)
提交回复
热议问题