Xiangfei Jia wrote:
I know that some part of memory is free, but they are used in caches
to optimise the performance when the system needs to allocate more
memory. And, dentry caches and disk buffer_head are used to minimise
disk access. SO, give the current mem info from "cat /proc/meminfo",
how sould I calculate how much memory is really free creently in the
system?
> cat /proc/meminfo
MemTotal: 1017848 kB
MemFree: 10380 kB
Buffers: 37480 kB
Cached: 149868 kB
Can I just assume that 70% of un-used memory (un-used=mem_total -
buffers - cached) is free, without actually causing the system to
swapping?
Thanks in advance!
Fei
is this what you are looking for ?
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);
man sysconf for further reading
thanks
ah_
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/