You are not logged in.

#1 2011-04-13 08:31:47

nasosnik
Member
From: Athens - Greece
Registered: 2011-03-10
Posts: 27

[SOLVED] System memory usage

My system, as soon as booting is completed, uses about 76 MB RAM. When running some applications, the used memory by them is not flushing away, but is still allocated even if the application is terminated.

For instance, if i run ls -R1 /   the used memory grows from 76 to 180 MB and it remains at 150 MB after the command is finished, until i reboot pc. Is that behaviour normal?

Last edited by nasosnik (2011-04-13 13:49:49)

Offline

#2 2011-04-13 11:33:48

lives2evil
Member
From: GMT+7
Registered: 2010-03-21
Posts: 244

Re: [SOLVED] System memory usage

Let's say you run "ls -R1" a second time, does your memory usage go up? What about the speed of output? And how many RAM do you have?
I suppose the answer is clear.


tsujeruplive, tnarongisi... ... ... ... ɥsılƃuǝ sı sıɥʇ

Offline

#3 2011-04-13 11:35:21

thisoldman
Member
From: Pittsburgh
Registered: 2009-04-25
Posts: 1,172

Re: [SOLVED] System memory usage

The behavior is normal.  Linux uses memory more aggressively than some other operating systems.  At the risk of making too general a statement, non-active items remain in cached memory unless an active item needs that memory space.  The time for the display of  'ls -R /' is noticeably less the second time it's run because of cached memory.

Memory usage is reported differently by different programs.  For example, 'ps'  reports memory for each process by PID as both VSZ, virtual set size, and RSS, resident set size.  Which value is the "real" memory use?

Unless the system slows by swapping memory to disk, memory use is not of much concern when running most apps and programs.

Offline

#4 2011-04-13 12:01:48

nasosnik
Member
From: Athens - Greece
Registered: 2011-03-10
Posts: 27

Re: [SOLVED] System memory usage

lives2evil wrote:

Let's say you run "ls -R1" a second time, does your memory usage go up? What about the speed of output? And how many RAM do you have?
I suppose the answer is clear.

No, if i run the command for a second time, memory usage stays the same. The second command execution is significant faster than first one (measured with time). I have 2 GB RAM.

Offline

#5 2011-04-13 12:12:04

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: [SOLVED] System memory usage

This is the way Linux uses the memory. See for instance Why is Arch using all my RAM? in the wiki and the article linked from there.


To know or not to know ...
... the questions remain forever.

Offline

#6 2011-04-13 12:23:53

redden0t8
Member
Registered: 2011-01-27
Posts: 42

Re: [SOLVED] System memory usage

nasosnik wrote:

No, if i run the command for a second time, memory usage stays the same. The second command execution is significant faster than first one (measured with time). I have 2 GB RAM.

Exactly.  The system sees that you have tons of free RAM, so it caches everything in case you use it again.

To clarify things a little, run the following:

$ free -m

My results are (all figures are in MB):

chris:~$ free -m
             total       used       free     shared    buffers     cached
Mem:           997        199        797          0          6        155
-/+ buffers/cache:         37        959
Swap:         1953          0       1953

So in my case, I have "997" MB total (actually 1 GB).  Of that, 199 MB is used and 797 MB is completely free.  But when you take the cache into account, I only have 37 MB used and 959 MB free.  That means 162 MB is cached data.  If it needs to be used again, it's right there already loaded.  If the system runs low on memory, it can safely discard the 162 MB instantly.  So if you want to know your "true" memory usage, look at "used" and "free" in the "-/+ buffers/cache" line.

Offline

Board footer

Powered by FluxBB