process memory change in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users process memory change in unix
# 1  
Old 06-10-2008
process memory change in unix

Hello! I was wondering if I could trouble all your experts with a couple questions regarding checking memory usage changes during the run time in the specific program (process) under UNIX.
1. After the program starts running, is ps the best way to tell the total memory usage at the any time?

2. If the malloc command is used in that program, for example total 50MB malloc is called, will the memory of the program be increased by 50 MB?

3. If the free command is used after the malloc command, for example 20MB is freed, will the memory usage is decreased by 20MB? Can other program start using that freed memory.

Thanks so much!
# 2  
Old 06-11-2008
1. top works.
Code:
#assume  process pid you want is 2350
 top -n 5000 -f t.lis
 grep 2350 t.lis

2. changes from malloc will be reflected in the display

3.
This requires more of an answer. To get memory for malloc to work with, especially 50MB chunks, the OS has to call brk() on behalf of the process. brk() maps more memory for the data segment into the process. Since brk() is an expensive call and you have to call brk() with a negative argument to "give memory back" most OS's do not do that. This is on the assumption that if the program called for that chunk of memory it may be called for again in the future. So, processes do not normally "shrink" during runtime.
# 3  
Old 06-12-2008
Bug

I understand now. Thank you very much for your detailed explanation.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to change allocated memory for a process?

Hello, I am running ubuntu 14.04 in a server with 32GB ram. Due to receiving "high load" errors during ssh connection, I took a look at what's happening from command line. I detected that 20GB of total memory was allocated to a program. Below you can see some initial part of installation... (4 Replies)
Discussion started by: baris35
4 Replies

2. AIX

Unable to change memory

Hello All, So it goes like this... I logged in to the HMC console , trying to change the memory of LPAR from 20 to 25 GB . It says that "your profile is configured to use maximum of only 20 GB" and not able to increase the memory. I created a new profile and filled "maximum memory " field... (4 Replies)
Discussion started by: gull05
4 Replies

3. Programming

Memory allocation for particular process in UNIX

I want to run a C program on my linux machine. I want to allocate specific heap size for that process (C program) to run. How can I do that? I know in Java same can be done using -Xmx option. There may be some option which I can specify in the C program like Java or may be in linux process. (8 Replies)
Discussion started by: Ankur Goyal
8 Replies

4. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

5. Emergency UNIX and Linux Support

CPU and memory utilization of a process, by process name

Can someone please help me with a script that will help in identifying the CPU & memory usage by a process name, rather than a process id.This is to primarily analyze the consumption of resources, for performance tweaking. G (4 Replies)
Discussion started by: ggayathri
4 Replies

6. Linux

change the memory address of ld.linux-so in a dynamically linked process

hi, For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process. And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to... (3 Replies)
Discussion started by: zerocool_08
3 Replies

7. UNIX for Dummies Questions & Answers

change the memory address of ld.linux-so in a dynamically linked process

hi, For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process. And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to change... (0 Replies)
Discussion started by: zerocool_08
0 Replies

8. Shell Programming and Scripting

Unix Script to find and kill a process with high memory utilization

Hi Unix Gurus i am somewhat new to unix scripting so need your help to create a script as below. # This script would find the process consuming memory beyond a certain #limit. if the meemory consumption is more than 100% for a period of 1 # minute for the specific process. the script would... (0 Replies)
Discussion started by: robinforlinux
0 Replies

9. UNIX for Dummies Questions & Answers

upper limit of accessible memory space for a single process in Unix/Linux

Hellp all, if there is 3G memory in my Unix server I want to know if all the 3G space can be used by ong sigle process. As i know, in Windows, one process can only access at most 1G memory despite there is probably more than 1G memory is equipped. (1 Reply)
Discussion started by: cy163
1 Replies

10. UNIX for Dummies Questions & Answers

Memory used by a particular process

how to get memory used by a particular process in unix? (3 Replies)
Discussion started by: superprogrammer
3 Replies
Login or Register to Ask a Question