Linux Memory Status

Posted on 2011-02-11
Last Modified: 2012-05-11
hi Experts,

I have a HP blade server (BL680)  running Redhat Linux with 135.527Gb of RAM. We use the server for processing our CDRs data. At the moment, the server is consuming all the 135Gb RAM! and we can't find out which process his hogging all this memory.

Kindly how we can find out which processes is/are ALL consuming the memory.

I have attached the output of the following commands.
1. uname -mrsn
2. free -g
3. vmstat -m
4. vmstat -a

Linux TZDARHQ-CDR02 2.6.18-92.el5xen #1 SMP Tue Apr 29 13:31:30 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux cdr-memory.txt
Question by:Seni
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +4
LVL 68

Expert Comment

ID: 34869154


ps -e -o vsz,rss,pid,args

This will show you on a per-process basis the

- total memory size of the process
- resident memory size
- process id
- the process name and arguments

Sort e.g. by virtual memory size with

ps -e -o vsz,rss,pid,args | sort -n -k1


LVL 68

Expert Comment

ID: 34869655
Since Oracle keeps its SGA in shared memory you should additionally check with:

ipcs -m

The size is shown in the "bytes" column.

Get the owning pid and other details of a given segment with

ipcs -m -i shmid

where shmid is to be taken from the column with that name shown by ipcs -m


Expert Comment

ID: 34869755
Have a look at your 'free -g' output.
Everything is OK!

Linux will always use every bit of RAM ever assigned and it will only release it if another program requires new RAM and there is none left.
Your 'free' output shows that there is no swap in use, which is good, and the most important line is the one about '-/+ buffers cache' where it says there is 121GB of free RAM that can be released for new RAM requests.
The only thing that seems to have happened is that your machine is running for so long with program requesting RAM, that it ran full by the time, but it never needed all its RAM at once. And this is the important fact.

vmstat shows no page swapping, so there really is nothing to be concerned about.
Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!


Expert Comment

ID: 34871509
Its very simple using top command. Simply type 'top' in the shell and hit enter.

By default top command displays the processes in the order of CPU usage.  When the top command is running, press M (upper-case) to display processes sorted by memory usage as shown below.
Top Command Sort By Memory Usage

see the attached sanpshot

Expert Comment

ID: 34873716
top is the way to go

Expert Comment

ID: 34878197
htop is an even better friend :-)

Expert Comment

ID: 34885091
Actually memory is not used by application, but it is used for disk caching.
If memory is not fully utilized by kernel than it is wasted, by keeping data in cache it reduces disk I/O and when an application needs data again it can be provided faster from the RAM. If an application demands memory the kernel will release memory according to the need.

If you want to see the memory from the perspective of application you should look at +- buffers/cache line, the free column of this line shows you the memory that can be used for applications.

In the case below my application is using 2GB of memory.

# free -m
total used free shared buffers cached
Mem: 7973 7323 650 0 128 5152
-/+ buffers/cache: 2042 5931
Swap: 8189 40 8149

Accepted Solution

Ferrosti earned 500 total points
ID: 34888035
Once again:
top and htop are not an option, since they show mem usage INCLUDING caches and buffers. The only way to go is using 'free' and having a look at the buffers/cache line or possibly by using vmstat and watch the servers swapping activity. Since the OP posted these logs it is quite clear that he´s got more than enough RAM for what he is doing ATM.

Expert Comment

ID: 34893367
I concur with Ferrosti. I do stress testing of applications with Oracle on Linux. I need to find the pressure on the system by putting virtual load. The only way of finding RAM usage is free. I also use iostat to get CPU usage, i/o wait etc. You may cat /proc/meminfo and look for the line Cached: and SwapCached:, these are cached space in RAM used by the kernel to reduce disk i/o.


Author Closing Comment

ID: 35015914
still analyzing the output

Featured Post

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration, of the HP EVA 4400 SAN Storage. The name , IP and the WWN ID’s used here are not the real ones. ABOUT THE STORAGE For most of you reading this, you …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension ( This reminded me of questions tha…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question