## Formula to calculate memory free

Hi,

I'm a new comer. I'm not sure if I post my question in the right place but if it is please help me to change to the right box.
I have a question about how to calculate the amount of memory free in SUSE. With my understanding:
Total mem free = Memory free + Swap free + Buffer + Cached (I assume Swap is free memory as well in my calculation).
I also found this link in the internet http://blog.thewebsitepeople.org/201...eak-detection/ which state that:
Buffers + Cached = Active(file) + Inactive(file) + ?X?.
Thus, my formula would become:
Total mem free = Memory free + Swap free + Active(file) + Inactive(file) + ?X?.

1/ As the above link is not an official link from SUSE, I can not prove if the formula is correct. Do any one have any idea about my calculation?
2/ What does ?X? in the above formula stand for?

3/ I also noticed that tmpfs is used in my system, about 101MB, please see example below. So the total of memory free must exclude tmpfs. Is my calculation correct for this case as well? If not, any suggestion?

I would be very appreciated if someone could clarify my confuse as I hardly find these kind of information in the internet.

Thanks and Regards,
Tuan

================================================== =============
control1:/dev/shm # df -kh
Filesystem Size Used Avail Use% Mounted on
rootfs 4.0G 572M 3.2G 15% /
/dev/sda7 4.0G 572M 3.2G 15% /
/dev/sda2 4.0G 145M 3.7G 4% /var/log
devtmpfs 458M 124K 458M 1% /dev
tmpfs 499M 101M 399M 21% /dev/shm
shm 499M 101M 399M 21% /dev/shm
/dev/sda1 4.0G 219M 3.6G 6% /boot
/dev/mapper/cluster_vg-data_lv 2.0G 578M 1.4G 31% /.cluster
192.168.0.100:/.cluster 2.0G 578M 1.4G 31% /cluster
control1:/dev/shm # free -m
total used free shared buffers cached
Mem: 997 309 687 0 18 184
-/+ buffers/cache: 106 890
Swap: 2055 0 2055
control1:/dev/shm # cat /proc/meminfo
MemTotal: 1021036 kB
MemFree: 703472 kB
Buffers: 19436 kB
Cached: 180996 kB
SwapCached: 0 kB
Active: 74444 kB
Inactive: 148148 kB
Active(anon): 22256 kB
Inactive(anon): 102432 kB
Active(file): 52188 kB
Inactive(file): 45716 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 2104508 kB
SwapFree: 2104508 kB
Dirty: 4 kB
Writeback: 0 kB
AnonPages: 22228 kB
Mapped: 10092 kB
Shmem: 102528 kB
Slab: 32600 kB
SReclaimable: 8136 kB
SUnreclaim: 24464 kB
KernelStack: 1152 kB
PageTables: 2872 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2615024 kB
Committed_AS: 260004 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 8884 kB
VmallocChunk: 34359726700 kB
HardwareCorrupted: 0 kB
AnonHugePages: 2048 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 114624 kB
DirectMap2M: 933888 kB
================================================== =============