Memory usage of a process having shared libraries


 
Thread Tools Search this Thread
Top Forums Programming Memory usage of a process having shared libraries
# 1  
Old 10-18-2010
Memory usage of a process having shared libraries

Hi,
I have the following two processes that's built with static libraries. Both the process have many common libraries.
-rwxr-xr-x 1 xxx xxx 152946280 Oct 15 08:38 server1
-rwxr-xr-x 1 xxx xxx 41633880 Oct 15 08:39 server2.

I built these two server processes making all the libraries shared (with kPIC option and -G in the make file). The size of the executable get reduced significantly as shown below.
-rwxr-xr-x 1 xxx xxx 580800 Oct 15 18:40 server1
-rwxr-xr-x 1 xxx xxx 246736 Oct 15 18:41 server2.

Now when I run these processes and monitor the memory usage (using top command), I would have thought that summing up memory usage of (RES column value) the latter two processes would be less than that of the former. But what I observe is exact opposite with both the processes showing higher values in shared case.Can somebody explain why? Is the memory usage that correspond to shared library also getting included as part of process memory usage.
Also I am not sure if I can use the top command to track the memory consumption.
Please advise.

Thanks
Srivatsan
# 2  
Old 10-18-2010
If you have a /proc filesystem, use that to investigate memory usage. Solaris requires a psinfo struct. For linux /proc/self/maps shows shared memory usage

I personally favor calling getrusage() on systems that fully support it, then print periodic advisory messages to the application log file.
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. HP-UX

Virtual Memory Usage a Process

Hi all, Is there any command which shows the virtual memory usage of a particular process in HP-UX machine. I have tried with ps, top but could not get what I want. Kindly provide me a solution. Thanks in Advance ARD (4 Replies)
Discussion started by: ard
4 Replies

4. 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

5. Emergency UNIX and Linux Support

Memory usage of a process having shared libraries

Hi, I have the following two processes that's built with static libraries. Both the process have many common libraries. -rwxr-xr-x 1 xxx xxx 152946280 Oct 15 08:38 server1 -rwxr-xr-x 1 xxx xxx 41633880 Oct 15 08:39 server2. I built these two server processes making all the... (1 Reply)
Discussion started by: srivatsan_vn
1 Replies

6. 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

7. 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

8. Solaris

Process Status Without Shared Memory

Hello Folks, On a Solaris 8 system I am trying to diagnosis memory usage of the running processes. I've been using prstat, and top , but the outputs of those include the shared memory used by the process. Hence, more a dozen of running processes are using the shared memory, and the total memory... (1 Reply)
Discussion started by: altinkaya
1 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. AIX

memory problem in AIX shared libraries

Hi All, I'm facing the following issue with my shared libraries in AIX. memory related calls such as memset, memcpy, malloc etc are failing miserably. there is something wrong with stack/memory which i can't guess. i've used the following flags to build my libraray: ld -G... (0 Replies)
Discussion started by: abhinav05252
0 Replies
Login or Register to Ask a Question