OT, determining real amount of free RAM

Brian Buhrow buhrow at nfbcal.org
Wed May 2 19:30:29 EDT 2012


	hello.  Typically Linux and other Unix-like operating systems will use
all the RAM they can get, either for programs or  file cache.  If any of
your programs have a memory leak, they will consume more memory as time
goes by and the machine stays up.  Even if that is not the case, which it
shouldn't be, the system will slowly use more RAM as it increases the size
of its file cache buffers.  My guess is that it is this file cache which is
consuming all available RAM and causing such low free memory numbers the
next day.  What will happen if you take out RAM is that the file cache will
not be able to grow as large, and, potentially, you'll notice a performance
hit if you try to do something file intensive, like grep through the entire
Linux source tree.  Other than that, you should notice few changes between
the amount of RAM you have and the lower amount.  Having said that, having
more RAM is good and you shouldn't take it out unless its absolutely necessary.
To get a better picture of how much memory is in use, as opposed to
available, I suggest 
vmstat -s.  The relevant data is the amount of active memory.  Active
memory is memory in use by the system, either processes or kernel, and is
the actual amount of RAM you need to run the programs that are currently
running.  If the amount of active memory is far lless than the total amount
of physical RAM than you have, then you could, in theory, take out any RAM
beyond that shown for active memory.  Again, I don't recommend it, but it
does show you the minimum you could get away with.


Below is sample output from vmstat -s on a system I have access to.



Hope this helps.
-Brian


      1024496 K total memory
       950180 K used memory
       705936 K active memory
        83760 K inactive memory
        74316 K free memory
       147132 K buffer memory
        17964 K swap cache
            0 K total swap
            0 K used swap
            0 K free swap
    176575778 non-nice user cpu ticks
       623698 nice user cpu ticks
    231096515 system cpu ticks
    472402143 idle cpu ticks
     33304561 IO-wait cpu ticks
           20 IRQ cpu ticks
       773038 softirq cpu ticks
            0 stolen cpu ticks
   1843653079 pages paged in
    612303167 pages paged out
            0 pages swapped in
            0 pages swapped out
   2665784924 interrupts
   3101884726 CPU context switches
   1331423124 boot time
      2564076 forks
On May 2,  2:55pm, Gregory Nowak wrote:
} Subject: OT, determining real amount of free RAM
} -----BEGIN PGP SIGNED MESSAGE-----
} Hash: SHA1
} 
} Hi all,
} 
} I've been wondering this for a while, and figured I'd ask here. How
} does one determine the amount of free RAM on a gnu/linux system? If I
} run "free -m" on one of my machines right after boot, I get something
} like:
} 
} total       used       free     shared    buffers     cached
} Mem:          2957       2933         24          0         78
} 1590
} - -/+ buffers/cache:       1263       1694
} Swap:          925          0        925
} 
} Here's what I'm getting at. First, I know what runs on this box, and
} this machine starts up with a limited amount of programs running, and
} pretty much stays like that as long as it remains powered up (running
} ps confirms this). What this machine starts with should take up about
} 1480 megs of RAM according to my calculations. Ok, let's add 100 megs
} extra for the system itself, and to make sure I've really accounted
} for what runs on this box. That would come out to about 1580 megs of
} RAM used, let's round up to 1600. I have also confirmed that if I
} physically pull a gig of RAM out, the machine will still run
} everything without heavy use of swap.
} 
} Second, if the machine stays up for 24 hours or longer, the amount of
} free RAM doesn't change much, but a few megs of swap is used. I assume
} this is for processes which haven't been used in a while. So, why am I
} seeing something around 20 megs free, instead of something around a
} gig? To put it another way, if I wanted to run this machine with a
} minimum amount of RAM how would I figure out how much I really need?
} Thanks in advance.
} 
} Greg
} 
} 
} - -- 
} web site: http://www.romuald.net.eu.org
} gpg public key: http://www.romuald.net.eu.org/pubkey.asc
} skype: gregn1
} (authorization required, add me to your contacts list first)
} 
} - --
} Free domains: http://www.eu.org/ or mail dns-manager at EU.org
} -----BEGIN PGP SIGNATURE-----
} Version: GnuPG v1.4.10 (GNU/Linux)
} 
} iEYEARECAAYFAk+hrW4ACgkQ7s9z/XlyUyDZzACgwce9sLkd/+Pw8rvfzNrNRBIF
} KcwAnjSjN5WHVfmr/HWV1/Jfu+5zeQGY
} =+PFb
} -----END PGP SIGNATURE-----
} _______________________________________________
} Speakup mailing list
} Speakup at braille.uwo.ca
} http://speech.braille.uwo.ca/mailman/listinfo/speakup
>-- End of excerpt from Gregory Nowak





More information about the Speakup mailing list