Process Mem usage

Process Mem usage

Post by David Scrèv » Sun, 20 Apr 2003 03:57:17



    Hello,

    I'm trying to retrieve the memory usage of current process, as the ps
command does. I did not find the source code for this command, then
I ask here if anybody could help in this issue. I found the getrusage system
call, but the linux implementation (and most of implementation) is not
complete, making this call quite useless.
    Any idea ?

David

 
 
 

Process Mem usage

Post by Basile STARYNKEVITC » Sun, 20 Apr 2003 04:11:06


    David>     Hello, I'm trying to retrieve the memory usage of
    David> current process, as the ps command does. I did not find the
    David> source code for this command, then I ask here if anybody
    David> could help in this issue. I found the getrusage system
    David> call, but the linux implementation (and most of
    David> implementation) is not complete, making this call quite
    David> useless.  Any idea ?

Use the /proc filesystem. If you want to retrieve detailed memory
usage on your own process, you can read the following files (textual
files)

  /proc/self/status - which has a VmSize: line
  /proc/self/stat
  /proc/self/statm

and the whole memory map is

  /proc/self/maps

If you want to know about another process, for example the process of
pid 1234, use /proc/1234/status /proc/1234/maps etc...

The detailed format of the output of /proc files is documented in the
kernel sources, in particular in
/usr/src/linux/Documentation/filesystems/proc.txt

[If David is frenchspeaking he could email me in French if he wishes]

--

Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net
aliases: basile<at>tunes<dot>org = bstarynk<at>nerim<dot>net
8, rue de la Fa?encerie, 92340 Bourg La Reine, France

 
 
 

1. large apache process mem usage

Hi all,

  We are currently running apache on two
machines: a box running solaris 2.6 and a box
running redhat linux v6.  We have quite a few
third-party modules compiled in to the apache
binaries, which grow in size with each one.  We
are currently using:

mod_ssl
mod_fastcgi
mod_php3
mod_perl

 on the solaris box, each httpd process is using
~14 megs total, ~6megs resident.  When we're
under heavy load, we can get 30 or more of these
processes at once, which can cause swapping.
First question - Is this normal memory usage?
Second - Is there any way to share more memory
from the parent process to the children?  Any
other suggestions for freeing up some memory?

Jim Sproull

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Mi$fortune

3. Any way to display the mem usage inside a process ?

4. External CDs and Linux.

5. how do i find other process's mem usage

6. ksaferppp

7. Mem Usage of own process

8. OpenGL on an embedded Linux RTAI system

9. How can I get CPU usage & mem usage in my program?

10. Need System Call to return %MEM (kernel mem) used by process

11. question about process memory usage and process memory limits

12. Getting process information/Controlling process resource usage

13. ps -el vs. monitor's mem usage