LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 02-21-2010, 02:53 PM   #1
avtandil_k
Member
 
Registered: Feb 2010
Distribution: CentOS,openSUSE
Posts: 30

Rep: Reputation: 16
Linux memory free vs buff


Hi I was wondering if anyone can explain this to me. I have a system in sort of an idle state. I mean nothing is going on on it. It is not a server of any kind. Built brand new openSuse 11.2 i386. What I have been noticing is the change in free memory amount: it is gradually declines and the buff amount is increasing. Here are my monitoring results.

Sat Feb 20 02:00:02 EST 2010
procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 0 611880 27640 270432 0 0 8 1 19 10 0 0 99 0 0
Sat Feb 20 09:00:01 EST 2010
procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
1 0 0 601824 37536 270884 0 0 3 1 17 8 0 0 100 0 0
Sun Feb 21 02:00:01 EST 2010
procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
4 0 0 517748 72840 319172 0 0 1 1 19 12 0 0 100 0 0
Sun Feb 21 15:00:01 EST 2010
procs -----------memory---------- ---swap-- -----io---- -system-- -----cpu------
r b swpd free buff cache si so bi bo in cs us sy id wa st
3 0 0 498504 91016 319988 0 0 1 1 17 10 0 0 100 0 0

Last edited by avtandil_k; 02-21-2010 at 04:04 PM.
 
Old 02-21-2010, 05:25 PM   #2
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,226

Rep: Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022Reputation: 2022
There's loads of qns here at LQ about this ; have a search. In short, Linux uses all the RAM to cache anything that's been used. No point having the RAM and not using it.
If the system needs some more RAM after it's full, it'll flush out the oldest/least used stuff. Don't worry, this is perfectly normal and Linux has a very good Virtual Memory driver.
 
Old 02-21-2010, 06:40 PM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,096

Rep: Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978Reputation: 978
Here's a couple to get you started:
- linux-memory-management
- linux-ate-my-ram

(the first one has a definition of buffer and cache)

Last edited by syg00; 02-21-2010 at 06:41 PM.
 
Old 02-22-2010, 11:05 AM   #4
avtandil_k
Member
 
Registered: Feb 2010
Distribution: CentOS,openSUSE
Posts: 30

Original Poster
Rep: Reputation: 16
Thanks. This is really helpful.
 
Old 02-22-2010, 09:21 PM   #5
sundialsvcs
Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 5,256

Rep: Reputation: 1076Reputation: 1076Reputation: 1076Reputation: 1076Reputation: 1076Reputation: 1076Reputation: 1076Reputation: 1076
Think about this...

"Memory" is the only thing in the entire computer that "is (almost) as fast as the CPU." It's the one-and-only system resource that the CPU doesn't have to wait for (much...).

Therefore, the system is designed to "fill it up." Once something has been loaded into memory, even if that "something" is no longer being used, the system won't go out of its way to replace it or remove it. It'll allocate unused memory instead (if it's available), in hope that "the previously-loaded something" will again be needed very soon ... a quite-reasonable assumption.

"Laziness" is a virtue among operating systems.

Today, most computers have a plentiful supply of RAM. So, "laziness" is richly rewarded with excellent perceived performance. The computer will not make any attempt whatsoever to be anything but "lazy" until, and unless, actual memory-pressure materializes.

Then, it will begin "an organized retreat" from its lazy position... withdrawing first one use of the "extra" memory, then another, then another.

All modern operating systems follow this very successful strategy. This is why, if you want to make a computer "more zippy," you should always add memory (buy as much as it will hold...) before you contemplate buying a faster CPU.
 
1 members found this post helpful.
  


Reply

Tags
free, memory


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Free-ing memory problem. C/C++, free() sevs Programming 6 03-13-2010 12:31 PM
LXer: Earcandy is the next cool thing you want in Linux if you are a media buff LXer Syndicated Linux News 0 08-11-2009 07:20 PM
[SOLVED] Memory leak: How risky not to free allocated memory. kaz2100 Linux - General 1 12-24-2008 12:00 AM
free() does not clear memory space in LINUX xinminhua Programming 32 08-18-2006 03:43 PM
diff in buff underrun and overflow? servnov General 7 10-27-2004 09:55 PM


All times are GMT -5. The time now is 03:26 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration