Results 1 to 6 of 6
Hello,
I have a server with 12 GB of RAM that's basically using it all...
[rootsrv ~]# free -m
total used free shared buffers cached
Mem: 11976 11881 95 0 ...
- 04-26-2010 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 20
Memory usage, ps output, etc.
Hello,
I have a server with 12 GB of RAM that's basically using it all...
[rootsrv ~]# free -m
total used free shared buffers cached
Mem: 11976 11881 95 0 631 6011
-/+ buffers/cache: 5238 6738
Swap: 8191 20 8171
[rootsrv ~]#
Though the ps auxf output doesn't seem to add up to 100% usage... so I'm trying to determine where ALL of the memory is being used...
ps auxf | awk 'BEGIN {FS=" "}{print $4" "$11" "$12" "$13" "$14" "$15}END {}' | sort -nr
... Is the command I've been using to sort %MEM usage for each process...
Two main questions:
1.) Is the ps auxf %MEM output total for every process supposed to correspond exactly with what's reported from free -m? Because there seems to be a discrepancy in terms of what ps auxf reports and what free -m reports, unless 0.0% MEM processes are rounded down...
2.) Is there a way I can add all of the fields in the first columns with a for loop?
Something along the lines of...
for i in `ps auxf | awk 'BEGIN {FS=" "}{print $4" "$11" "$12" "$13" "$14" "$15}END {}' | sort -nr | cut -d ' ' -f1`; do ($i + $i); done
Just to check if all of the %MEM percentages actually total near 100%?
Thanks in advance for your assistance.
- 04-27-2010 #2Just Joined!
- Join Date
- Jul 2008
- Posts
- 81
- 04-27-2010 #3
The -/+ buffers/cache: line is telling you that your processes are using less than half your memory. Modern Linux kernels will suck up free memory for use as buffer/cache, and free the memory up as needed by processes.
Trying to account for memory like it was your checkbook, particularly reconciling numbers reported by different programs, will drive you nuts. Or would me.
- 04-27-2010 #4
greyhairweenie is right, Linux utilizes memory in complex ways and trying to break it down to a simlistic view will drive a person insane. The philosophy is simple though: unused RAM is a waste of resources, so the kernel uses it for anything and everything that it can. As a side note: dont try and reconcile the swap area either because a process can exist in RAM, swap, or both areas at the same time.
I wouldnt worry too much about RAM until my vmstat begins showing large numbers of blocks being swapped in and out. Thats when there is a problem.
--Brett
- 04-27-2010 #5
And likewise like he said, regarding swap.
- 04-27-2010 #6Just Joined!
- Join Date
- Mar 2007
- Posts
- 20
Thanks for the information, guys... very informative.
Next time I'll try to not take the easy way out and RTFM. lol
Again, thank you.


Reply With Quote
