You are not logged in.

#1 2011-06-15 08:24:53

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

[SOLVED] How to see real Linux Ram usage ? (diferent values)

Hi everyone,
I am using Linux (Ubuntu at start and now Arch Linux) since 2004. I never had problems to understand it but now I have a problem that I cannot understand.

I have 2 computers (one is mine Asus 1215N and one is from my girlfriend Asus 1005HA), the first one has Arch Linux with Gnome3, and the seconde one has Arch Linux with Xfce4.

When I check the ram I get this (on my Asus 1215N):

(Terminal 'free') :
Total - 2055584
Used - 497792
Buffers/Cache Used - 164288

(Gnome System Monitor)
162,4 Mib (8,1%) de 2,0Gb

Conky
Ram Usage 488Mib/1.96Gib - 24%

So, apparently Gnome System Monitor only show me the Buffers/Cache Used memory (isn't that wrong ?) and the other two show me the "real" Ram usage (~488Mb)

Now on the seconde laptop conky show me the Buffers/Cache Used memory (when i look at it I see for example 120Mib but when I look at 'free' he says to me that the used memory is 500Mib.

So right now I don't really undestand who's wrong and who's right... did my Gnome3 really use 400mb at startup ? Did the xfce of my girlfriend really uses ~70-120mb at startup ?

(PS: we have the same conkyrc file.

Thanks in advance

Last edited by aliasbody (2011-07-08 10:00:33)

Offline

#2 2011-06-15 09:03:05

Zom
Member
From: Sweden
Registered: 2007-10-27
Posts: 430

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

Hi there.

Usually when you want to know how much memory a system is using, you go by the +/- buffers/cache value. This subtracts memory that's used for caching files and just goes by the current memory allocated to applications.

The way linux works is by allocating as much memory available to cache recently used files. This is to improve performance, since it's much faster to access stuff from RAM rather than on disk. When a program needs to allocate more memory, it just removes some of the cached memory and uses that instead.

Going by your post, conky doesn't subtract cache and buffers from used memory, though I could've sworn it should be able to.

(This is all AFAIK though, I could be wrong too).

E: Oh, and you can also use free -m instead of just free to see the mem usage in megabytes instead of kilobytes.

Last edited by Zom (2011-06-15 09:04:22)

Offline

#3 2011-06-15 09:04:05

Awebb
Member
Registered: 2010-05-06
Posts: 6,272

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

Offline

#4 2011-06-15 09:23:59

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

Thanks for your help. But if the Buffers/Cache free is the real Free ram as I understand, then Free Memory is the allocated for software (but free)... That seem's good, but I have a question, I have made a teste, when I tried to open a lot of Chromium tabs (Chromium is a good example as it uses a LOT of ram..)

Then the Buffers/Cache Free was at 1200Mib / 2000Mib (At free -m)
and Free Memory was at 19500 Mib / 2000Mib (At free -m)

And then the system starts using swap...

So if the Buffers are the really free ram and the Free Memory the all allocated memory and free why doesn't he cleans the allocated/cache before creating a new and starting using the swap ?

Ps : And why did I got 2 diferent values from 2 pc's with the same conky configuration ? (since the first laptop show Free Ram and the second onde show Buffers/Cache)

Thanks in advance for all your help

@Awebb : nice website ^^ very good information

Offline

#5 2011-06-15 09:36:44

Zom
Member
From: Sweden
Registered: 2007-10-27
Posts: 430

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

aliasbody wrote:

Thanks for your help. But if the Buffers/Cache free is the real Free ram as I understand, then Free Memory is the allocated for software (but free)... That seem's good, but I have a question, I have made a teste, when I tried to open a lot of Chromium tabs (Chromium is a good example as it uses a LOT of ram..)

Then the Buffers/Cache Free was at 1200Mib / 2000Mib (At free -m)
and Free Memory was at 19500 Mib / 2000Mib (At free -m)

And then the system starts using swap...

So if the Buffers are the really free ram and the Free Memory the all allocated memory and free why doesn't he cleans the allocated/cache before creating a new and starting using the swap ?

You seem to have the terms mixed up. Used memory is the cached memory and the memory allocated for applications grouped together. +/- buffers/cache is only the memory allocated for applications (It basically means used memory - buffers and cache).

As to why it starts swapping, I have no idea. It shouldn't, unless it's really out of RAM.

aliasbody wrote:

Ps : And why did I got 2 diferent values from 2 pc's with the same conky configuration ? (since the first laptop show Free Ram and the second onde show Buffers/Cache)

That's very strange too. Are you absolutely sure that the configs are the same? Sounds like yours is missing the no_buffers option.

Offline

#6 2011-06-15 09:44:46

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

@Zom : no_buffers ? my no_buffers when on "no" show me 1,04Gib of Ram (free -m 495Mb) when no_buffers is "yes" then show me 1.47Gb of Ram (free -m 495Mb) :S....

Offline

#7 2011-06-15 10:28:58

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

aliasbody wrote:

So if the Buffers are the really free ram and the Free Memory the all allocated memory and free why doesn't he cleans the allocated/cache before creating a new and starting using the swap ?

You can decide how much memory you want to swap beforehand. If you're swapiness is set to anything above 0, it will swap before it runs out of memory.

Offline

#8 2011-06-15 10:46:55

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

@lukaszan : OH ! I dind't know that it was possible to change that :S (on what planet did I live ? I am using linux XD)... How can I do that ? and How value did you recommend ?

Edit: My swapiness is already at 60...

Last edited by aliasbody (2011-06-15 10:49:10)

Offline

#9 2011-06-15 11:19:18

Zom
Member
From: Sweden
Registered: 2007-10-27
Posts: 430

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

aliasbody wrote:

@Zom : no_buffers ? my no_buffers when on "no" show me 1,04Gib of Ram (free -m 495Mb) when no_buffers is "yes" then show me 1.47Gb of Ram (free -m 495Mb) :S....

Yes, it shows 1.47GB of the RAM as unused when you don't count buffers into it with conky. Or in other words, ~500MB used, just like free -m reports. smile

E: Perhaps you could post your conkyrc and we'll see if I understood your post correctly?

Last edited by Zom (2011-06-15 11:20:05)

Offline

#10 2011-06-15 11:23:21

lukaszan
Member
Registered: 2011-05-05
Posts: 117

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

If you have plenty of RAM set it to 0.

Here is how you can do it:
https://wiki.archlinux.org/index.php/Ma … erformance

On the fly you can use:

sysctl -w vm.swappiness=0

And here is a very interesting article (which I just read, prompted by this thread btw):
http://rudd-o.com/en/linux-and-free-sof … o-fix-that

Offline

#11 2011-07-08 10:00:18

aliasbody
Member
From: Portugal
Registered: 2010-12-16
Posts: 157
Website

Re: [SOLVED] How to see real Linux Ram usage ? (diferent values)

Thanks for you help ^^ I'll mark this thread as Solved then big_smile

Offline

Board footer

Powered by FluxBB