fedora core free -m vs system monitor

Why would i get different numbers when running free -m vs system monitor? I have been running firefox with flash for a few days and my machine has gotten slow; it took all 1GB of my memory so I shut out firefox and npviewer.bin and system memory now says I am at 192Mb of ram where as free -m saids 647Mb?

Any thoughts, I would think system monitor is right.

Answer

Under any remotely sophisticated operating system, there is no clear notion of how much memory a particular application uses, or how much memory is free. The main sources of complications are:

  • If you have swap, do you include free swap space in the free memory? If you don’t, what’s the point of having swap? But if you do, you’re likely to always have a lot of free memory, even if your system is thrashing (i.e. swapping a lot) due to the lack of RAM.
  • There are many uses for memory. The main two are memory allocated by applications, and memory devoted to disk caches. These two typically have the same order of magnitude on a non-resource-starved system. If you only count the memory that is not used for any purpose, it’s normal to have very little: disk caches won’t go away until there is a need for their memory. But if you include the disk caches in the free memory, you might think you can fill it all up with application memory, but then you will thrash due to the lack of disk cache.
  • Shared memory makes it difficult to count the portion of memory allocated to a particular application. Shared memory includes things like shared libraries and disk caches for files that more than one application has open.

So both numbers you report are probably right, just counting different notions of “free memory”. (And free reports several numbers; you didn’t say which one 647MB is — in the -/+ buffers/cache line, disk caches count as free memory, whereas in the Mem line, they don’t.)

Attribution
Source : Link , Question Author : David , Answer Author : Gilles ‘SO- stop being evil’

Leave a Comment