0

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.

network-tech
  • 21
  • 1
  • 3

1 Answers1

2

This one took me a bit to understand. When you run "free -m" you need to look at the "-/+ buffers/cache" line under the free column. This shows the available memory for use. Memory that has been used and released back to the system is just notated differently. As far as the system is concerned, it's not free, but it's also not in use and available for programs to pull from.

Matt W
  • 129
  • 3