Xiangfei Jia wrote:
you may use _SC_AVPHYS_PAGES field of sysconf
#include <unistd.h>
eg : long ret = sysconf( _SC_AVPHYS_PAGES);
alternatively
#include <unistd.h>
int get_avphys_pages(void);
Thanks for your reply!
Just checked that sysconf is not a syscall, so it's a libc implemented
fuction. The quote from libc doc about using
'sysconf(_SC_AVPHYS_PAGES)' is: "The value returned for
|_SC_AVPHYS_PAGES| is the amount of memory the application can use
without hindering any other process (given that no other process
increases its memory usage). The value returned for |_SC_PHYS_PAGES|
is more or less a hard limit for the working set. ".
I don't exactly know how libc implements this function (I haven't dig
into the source code). It seems that the return value is calculated as
'unused = total - cached - buffers'. But, I still don't know how of
cached and buffer memory is really free.
Regards!
Fei
Hi, you missed to CC kernelnewbies at nl.linux.org
check /proc/slabinfo
Regards
ah_
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/