How can I check actual memory usage each Process?

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers How can I check actual memory usage each Process?
# 1  
Old 05-16-2017
How can I check actual memory usage each Process?

I can't check actual memory usage in the Redhat 5.5...

The used memory is 14214 Mb of Total 15919 by Free -m command.

I sum the RSS value on PS aux command result and the value is 5428.66Mb.

Yes It's quite different actual usage memory and RSS value.

So I added Shared memory value (4882.22Mb) by ipcs command but It's still quite different even though I added shared memory value to RSS value

Please help me.... now our one of servers reach the memory over 90%.

I can't check which process is taking many memory now..

Code:
[root@ ~]# ipcs -m | awk 'BEGIN { TOTAL = 0 }{ TOTAL = TOTAL +$5}END{print TOTAL}'
4999377

Code:
[root@ ~]# ps aux | awk 'BEGIN { TOTAL = 0 }{ TOTAL = TOTAL +$6}END{print TOTAL}'
5567792

Code:
[root@ ~]# free -m
             total       used       free     shared    buffers     cached
Mem:         15919      15669        250          0        629        823
-/+ buffers/cache:      14215       1704
Swap:        10236       1073       9163

# 2  
Old 05-16-2017
Have a look at the manual page for ps. i haven't got RHEL at the moment, but I think that the -l (lower case L) will give you what you need. It's a long listing and you need the SZ column.



I hope that this helps,
Robin
# 3  
Old 05-16-2017
What's your system? I can't make sense of your 'free' output. That "+/- buffers/cache" line is particularly baffling. If you have a lot of buffers, that's almost the opposite of being out of memory.
# 4  
Old 05-16-2017
Quote:
Originally Posted by Corona688
What's your system? I can't make sense of your 'free' output. That "+/- buffers/cache" line is particularly baffling. If you have a lot of buffers, that's almost the opposite of being out of memory.
I typed PS -l as your guide but I got below result.


Code:
[root@ ~]# ps -l
F S   UID   PID  PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
4 S     0 26124 26085  0  76   0 - 25780 wait   pts/1    00:00:00 su
4 S     0 26125 26124  0  75   0 - 16519 wait   pts/1    00:00:00 bash
4 R     0 26227 26125  0  77   0 - 15877 -      pts/1    00:00:00 ps

the system is Redhat 5.5

Last edited by Don Cragun; 05-17-2017 at 02:05 AM.. Reason: Remove duplicated text.
# 5  
Old 05-18-2017
This is how you can identify memory growth per process
Code:
ps -eo pid,user,rss,vsz,stime,args | cut -c-200 | sort -k3n | tail -50 > mem1

The file mem1 contains the pid and rss and vsz values.
After a couple of minutes do it again but this time to file mem2
Code:
ps -eo pid,user,rss,vsz,stime,args | cut -c-200 | sort -k3n | tail -50 > mem2

Now you can compare mem1 and mem2.
A helpful command is
Code:
awk 'BEGIN {print "growth  pid  user  rss  vsz  stime  args"} NR==FNR {s[$1]=$3+$4; next} (($1 in s) && $3+$4>s[$1]) {print "+"$3+$4-s[$1],$0}' mem1 mem2

This User Gave Thanks to MadeInGermany For This Post:
# 6  
Old 05-21-2017
RedHat

There is no command that gives the “actual memory usage of a process” because there is no such thing as the actual memory usage of a process.

Each memory page of a process could be (among other distinctions):

1.Transient storage used by that process alone.
2.Shared with other processes using a variety of mechanisms.
3.Backed up by a disk file.
4.In physical memory or swap.

I think the “dirty” figure adds up everything that is in RAM (not swap) and not backed by a file. This includes both shared and non-shared memory (though in most cases other than forking servers, shared memory consists of memory-mapped files only).

The information displayed by pmap comes from /proc/PID/maps and /proc/PID/smaps. That is the real memory usage of the process — it can't be summarized by a single number.

Christian
Network Admin
Free SharePoint Hosting

Last edited by ChristianC123; 05-24-2017 at 04:19 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Find memory usage for a process

I have multiple oracle databases on one server. All the database are running from the same user i.e. oraent. The process for each database can be distinguished by the ps -ef command Eg : ps -ef | grep oraentThe Output : oraent 5361 1 0 20:58:05 ? 0:00 oracledb1... (11 Replies)
Discussion started by: yashreads
11 Replies

2. Solaris

Process memory usage

hi all gurus: I want to find out Solaris process memory usage, but got a bit confused, see if any one can provide me some guidance. i tend to use prstat -a to get total memory consumption by user (I know prstat likely have a bug that simply sum up the memory, regardless if the memory being... (5 Replies)
Discussion started by: oakville
5 Replies

3. Solaris

Memory Usage check

Hello Friends, I need to check memory usage & availability before I could run a program if there is enough memory is left or not, so how could i achieve this? Which command output i should rely on? I have diplayed outputs of SAR, VMstat and PRstat commands below, But how could i check memory... (8 Replies)
Discussion started by: EAGL€
8 Replies

4. AIX

Problem with nmon, actual CPU usage per process

Hi all, I am currently having trouble to get nmon to print me the actual CPU usage for an interval for a process. According to the manual, something like # time nmon -t -C cron -s 5 -c 2 -F outfile real 0m0.98s user 0m0.03s sys 0m0.04s should print out at least the process... (15 Replies)
Discussion started by: zaxxon
15 Replies

5. Linux

how to check memory usage ?

hello, I have purchased VPS from one webhosting company. VPS comes with Virtuozzo power panel. It has 512MB gurranted RAM and dynamic RAM 2048 MB. I have hosted single domain with 50MB database and wordpress installation. But I am getting resource alerts. It goes sometime in yellow... (8 Replies)
Discussion started by: mrugesh78
8 Replies

6. UNIX for Advanced & Expert Users

collecting memory usage by a process

Hi Guys, I work on a AIX environment and I'm trying to write a script where I can collect all the memory used by a process. Basically I'm executing the command 'ps -fu userid' to get all the process ids and then executing the 'ps v PID' to get all the memory allocated by PPID. My question is... (2 Replies)
Discussion started by: arizah
2 Replies

7. HP-UX

how could I get a process Memory Usage

I use pstat API to get Process Infomation I would like to get a process 1.process owner 2.how many physical memory and virtual memory and total memory used(KB) and usage(%) 3.a process excution file create time 4.a process excution file access time I do't know which attribute it i need ... (3 Replies)
Discussion started by: alert0919
3 Replies

8. Shell Programming and Scripting

Memory usage of a process

hi all, i want to write a script that checks the memory usage of processes and send a mail with the name of the process witch is using more then 300mb RAM. dose anybody have a sample script or an idea how i can make it ? PROCCESSES="snmpd sendmail" for myVar in $PROCCESSES do ... (7 Replies)
Discussion started by: tafil
7 Replies

9. UNIX for Advanced & Expert Users

how to restrict memory usage by a process

we are running red hat ES4 and i would like to know if there is anyway of restrcting the maximum amount of memory that a process can get? I have a single preocess that is taking >13GB. Thanks, Frank (4 Replies)
Discussion started by: frankkahle
4 Replies

10. Programming

how to use ioctl to check out memory usage

Hi all, I tried to output memory usage information while the process is executing at a particular time. I found out some people suggesting calling the ioctl. I followed it and wrote a test example: #include <unistd.h> #include <stdlib.h> #include <iostream.h> #include <fcntl.h> #include... (2 Replies)
Discussion started by: lanchen
2 Replies
Login or Register to Ask a Question