I am trying to incorporate this feature into a script I am writing. From what I understand "free -m" does not report accurately. From what I understand the memory is used, Linux does not "free" it until it actually needs to. For example if I have 32GB of ram and I did a
malloc(1024*1024*1024*31)
It would appear as if all the memory was used (even after terminating the process) until I bounce the box. Is there a simple way to get an accurate memory count? For example if all 100 processes and the kernel, summed together, are using 14GB of ram, I want to report 14GB regardless of what free -m says.