LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-05-2010, 12:16 PM   #1
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
Memory usage: what's telling the truth?


On my system, I get the following results for memory usage

"free" command: 210MB, 473 including buffers and cache
"top" command: 370MB
gnome-system-monitor: 180MB

So, what's the true story?
 
Old 06-05-2010, 12:27 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
what's the exact output free -m?
 
Old 06-06-2010, 11:39 AM   #3
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Original Poster
Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
I've just got this

bash-3.2$ free -m
total used free shared buffers cached
Mem: 1136 261 874 0 12 147
-/+ buffers/cache: 101 1034
Swap: 0 0 0

Evidently things are never the same two days running!
 
Old 06-06-2010, 11:43 AM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Your free memory is 1034. There was a really informative article about making sense of 'free' posted here on LQ some time ago. I can't seem to find it.
 
Old 06-06-2010, 09:52 PM   #5
brucehinrichs
Member
 
Registered: Mar 2008
Location: US
Distribution: Debian Sid; Sabayon, UbuntuStudio, Slackware-multilib 13.1, Peppermint Ice, CentOS
Posts: 575

Rep: Reputation: 69
Was it this one?

http://www.linuxatemyram.com/
 
Old 06-07-2010, 01:44 AM   #6
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,836
Blog Entries: 1

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Originally Posted by brucehinrichs View Post
Yeah, thanks
 
Old 06-07-2010, 12:03 PM   #7
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Original Poster
Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
I understand what "free" does. My point was that different tools disagreed with one-another.

In fact, a closer look at "top" and "free" shows they are in agreement. It's gnome-system-monitor that's out of step; it should show more memory in use than "free", as it's using memory to run, yet it shows less. The moral would appear to be "Beware of GUI tools and always trust your CLI."
 
Old 06-09-2010, 04:54 PM   #8
Revery
LQ Newbie
 
Registered: Jun 2010
Posts: 4

Rep: Reputation: 1
What version of gnome-system-monitor are you using? In mine, when I look under the Resources tab, it shows 1.8GB used. When I type "free -m" it says 3852 (3.8GB) used, but 1807 (1.8GB) used for the "-/+ buffers/cache" row which is the one we really want. Top of course shows 3.8GB being used, and is scary (I don't like it). Basically my gnome-system-monitor is running correctly (at least to what the user wants to know). In Help->About I get version "System Monitor 2.28.0".

Additionally, you might want to look at ksysguard, which is the KDE process manager, which is good in its own ways (allows tree-view of process list and a few other cool things), but worse than gnome-system-monitor in others, and doesn't require you to be in KDE to use; you can just install it from the package manager.
 
Old 06-10-2010, 07:35 PM   #9
ncsuapex
Member
 
Registered: Dec 2004
Location: Raleigh, NC
Distribution: CentOS 2.6.18-53.1.4.el5
Posts: 770

Rep: Reputation: 44
If you run top and you see these lines:

Mem: 2062712k total, 2010384k used, 52328k free, 248168k buffers
Swap: 0k total, 0k used, 0k free, 1619436k cached


MEM is the total memory you have. USED is used memory plus memory in cache. CACHED is memory that is not being used by an app but is in cache ready to use. So in my example 443276 is being used by the system.



At least this is how I interpret it. If Im wrong maybe someone will correct me.
 
Old 06-10-2010, 09:36 PM   #10
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,119

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
This is closer to the correct description of buffers and cache.
 
Old 06-11-2010, 09:12 AM   #11
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by syg00 View Post
This is closer to the correct description of buffers and cache.
I read that up to the important, and I think incorrect, sentence:
Code:
SHR indicates how much of the VIRT size is actually sharable memory or libraries).
I have looked at /proc/pid/smaps in comparison to the SHR value reported by top. I have seen elsewhere that same claim that SHR is the sharable portion of VIRT. But when I actually look, SHR is way too low to be the sharable portion of VIRT.

I think SHR is the sharable portion of RES. I don't know how to tell for sure. But I haven't seen any cases that can be easily shown to contradict the idea that SHR is the sharable portion of RES.

I also dislike the sentence from that page
Code:
VIRT stands for the virtual size of a process, which is the sum of memory it is actually using
"Actually using" is ambiguous enough that I can't say flat out the above sentence is wrong. But that sentence is at least seriously misleading. VIRT typically includes a lot of "demand zero", "copy on write", and "untouched library pages", areas that are all memory the process hasn't used yet, isn't using now, and probably never will use.

Regarding the details of Buffers and Cache in that page, I don't know enough and/or didn't read carefully enough to comment on whether the page is accurate.

Last edited by johnsfine; 06-11-2010 at 09:23 AM.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Telling the Truth About Software Patents and Innovation LXer Syndicated Linux News 0 11-02-2007 10:51 PM
X hangs after prolonged usage ... memory usage goes upto 195MB duryodhan Slackware 18 05-10-2007 06:16 PM
getting realtime info on memory usage-cpu and harddrive usage steering Linux - Newbie 5 03-03-2005 08:43 PM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
Controlling CPU usage & memory usage Saravana babu Linux - Software 0 02-18-2004 05:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration