![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| upper limit of accessible memory space for a single process in Unix/Linux | cy163 | UNIX for Dummies Questions & Answers | 1 | 04-30-2007 07:09 AM |
| Process using the most memory | janet | AIX | 5 | 03-22-2006 03:33 AM |
| Memory in Use by a process | khopdi | Shell Programming and Scripting | 0 | 10-18-2005 11:59 AM |
| Memory used by a process | luft | UNIX for Dummies Questions & Answers | 3 | 08-18-2005 03:27 PM |
| Memory used by a particular process | superprogrammer | UNIX for Dummies Questions & Answers | 3 | 06-11-2005 10:51 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
1. top works.
Code:
#assume process pid you want is 2350 top -n 5000 -f t.lis grep 2350 t.lis 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
|
|||
|
|||
|
I understand now. Thank you very much for your detailed explanation.
|
|||
| Google The UNIX and Linux Forums |