Re: How to get system memory usage from C program?



James X. Li wrote:

"ltrace" shows that the "free" command uses a function meminfo() to get the information.
Doesn't anybody know how do I call this function directly from
a C program?

free opens /proc/meminfo and filters out the info it needs. meminfo() is simply a helper function used by free, part of procps, used to obtain that info.

do an strace to see what it actually does.


Igmar
.