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 NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.


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

MongoDB Through a MySQL Lens

This article looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.

Question has a verified solution.

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

SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Fine Tune your automatic Updates for Ubuntu / Debian
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

623 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