Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 03-01-2013, 02:23 PM   #1
LQ Newbie
Registered: Mar 2013
Posts: 2

Rep: Reputation: Disabled
Unhappy High memory problem free -m and ps aux does not match

I am tired of searching for this info online, found solution and tried it but it never worked. PLEASE all the LINUX gurus help me out.

I have a host running on Linux 2.6.18-238.5.1.el5, 2 CPU x86_64 processor.
The host has total memory allocation of 32GB ram.

This is a virtual host. I am trying to debug a high memory issue. I have 1 jvm (Max 3GB) 3 other jvms(Max 6GB) which perform intensive processing and also has disk i/os.

of the 32 GB of RAM I am typically using only 3+6+6+6= 21GB of RAM. The rest of the tasks running on the server are the kernal specific and other application monitoring threads, event triggering threads which total does not exceed 6Gb as per configuration.
So as per configuration I would expect 21Gb+6Gb being used anytime of the total 32 Gb.
When the server is on load we notice high memory(99%+) utilization on our servers and thus resulting in slowness and out of mem exception or so.

This high memory utilization is reflected while doing free -m or while memory info is recorded using tools like nmon/sar.

Now I want to identify which process is consuming most of the memory.
I gathered stats using 'ps aux' when the free -m was giving high
-/+buffers/cache which is almost close to 32 Gb and times when
-/+buffers/cache had used close to 16 Gb.

what I noticed was independent of what free -m says
1. ps aux (VSZ) gives me memory utilization of always 29 GB or more ( even when free -m says 16Gb is in use).
2. In fact ps aux also says that my 4 JVMs are using 23GB instead of allocated 21 Gb.

top obviously does not give me the complete list. What would be the correct command which would give me process vs their respective memory utilization. I was to get statistics per process which could justify high memory utilization as recorded by 'nmon' and as shown by 'free -m'
Old 03-01-2013, 06:07 PM   #2
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Processes share memory. You can't just add them up like independent items.

For example this
ps aux |awk '{s += $5};END{print s}'
says 29GB on my host which has nothing like that.
1 members found this post helpful.
Old 03-01-2013, 09:19 PM   #3
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 16,471

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
There must be several thousand threads - both here at LQ as well as everywhere else on the web.
Short answer is that there is no short answer - shared memory, kernel uses, slab cache (no it's not included in the cache you see elsewhere) ...
That is a really old kernel, and by the looks of it only 32-bit. Years ago Linus said he would refuse to even talk to people who have that much memory on 32-bit. Let's see the output of these - use [code] tags around what you post
uname -a
cat /proc/meminfo
Old 03-02-2013, 03:01 PM   #4
LQ Newbie
Registered: Mar 2013
Posts: 2

Original Poster
Rep: Reputation: Disabled

linosaurusroot and syg thanks for your response. I agree now I understand better what ps aux gives.

syg here is the output of the commands that you requested for.
uname -a
Linux preview12 2.6.18-238.5.1.el5 #1 SMP Mon Feb 21 05:52:39 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

cat /proc/meminfo

MemTotal: 32959392 kB
MemFree: 1382112 kB
Buffers: 106232 kB
Cached: 567096 kB
SwapCached: 3123020 kB
Active: 16119796 kB
Inactive: 560760 kB
HighTotal: 0 kB
HighFree: 0 kB
LowTotal: 32959392 kB
LowFree: 1382112 kB
SwapTotal: 8385920 kB
SwapFree: 4271728 kB
Dirty: 356 kB
Writeback: 0 kB
AnonPages: 15718548 kB
Mapped: 31400 kB
Slab: 101948 kB
PageTables: 39800 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 24865616 kB
Committed_AS: 18845540 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 267336 kB
VmallocChunk: 34359470455 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 2048 kB


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
free memory confusion problem kpachopoulos Linux - Newbie 5 03-31-2008 03:59 PM
free says 500mb memory used... ps aux says otherwise Fayte Linux - Software 5 04-25-2005 05:47 AM
Help!?! RH 8 Memory Mapping -High Memory-Virtural Memory issues.. Merlin53 Linux - Hardware 2 06-18-2003 04:48 PM
Memory free problem edreddy Programming 1 11-09-2002 10:59 PM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:21 PM.

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