ELF memory sizes

ELF memory sizes

Post by Sidewind » Thu, 08 Feb 1996 04:00:00



Hi all,

        I was wondering if anyone could tell me why the memory sizes
reported under ELF systems are 10 times that of a.out systems? I am not
questioning the values, but merely wish to know what they contain. Ie does
it contain shared memory? Another question is, Is there a way to find out
which shared libraries are loaded? A method like /proc/modules would be
useful.

These are my memory size values for bash running under various systems.

--- Linux 1.3.59 ELF - 300k binary - bash 1.14.6(1) - procps-0.99
USER       PID %CPU %MEM  SIZE   RSS TTY STAT START   TIME COMMAND
jmbox    12168  0.0  7.5  1132   512  p3 S    00:44   0:03 /bin/bash

--- Linux 1.2.13 - 300k binary - bash 1.14.5(1) - procps-0.97
USER       PID %CPU %MEM SIZE  RSS TTY STAT START   TIME COMMAND
jmbox     5963  2.6  9.9  101  644 pp1 S    06:57   0:01 -bash

--- SunOs 4.1.4 - 400k binary - bash 1.14.5(1)
USER       PID %CPU %MEM   SZ  RSS TT STAT START  TIME COMMAND
jmbox     2130  0.0  0.0  116    0 co IW   06:03   0:03 -bash (bash)

--- Solaris 2.4 - 600k binary - bash 1.14.4(1)
USER       PID %CPU %MEM   SZ  RSS TT       S    START  TIME COMMAND
estbvau   4917  0.1  0.8 1092  924 pts/9    S 06:56:51  0:01 bash

Thanks, James
--


University of Warwick, UK        WWW: http://www.dcs.warwick.ac.uk/~jmbox/

 
 
 

1. How to get virtual memory size and working set size of a process on AIX ?

I know I should use getprocs(). It returns "struct procsinfo" object.
but there is no any document about what each field means in procsinfo
except the few comments in the header file /usr/include/procinfo.h

I wonder if anyone knows how to calculate the virtual memory size
and working set size of a process. Here is what I did, but I don't
know if it is correct. Thanks.

struct procsinfo buffer;
pid_t pid = getpid();
if (getprocs (&buffer, sizeof(buffer), NULL, 0, &pid, 1) != -1)
{
        workingSetSize = (buffer.pi_drss + buffer.pi_trss) * 4096;
        virtualSize = buffer.pi_dvm*4096 + buffer.pi_tsize;

Here is struct procsinfo:

struct procsinfo
{
        ......
        /* memory */
        unsigned long   pi_adspace;     /* process address space */
        unsigned long   pi_majflt;      /* i/o page faults */
        unsigned long   pi_minflt;      /* non i/o page faults */
        unsigned long   pi_repage;      /* repaging count */
        unsigned long   pi_size;        /* size of image (pages) */

        /* size of text */
        unsigned long   pi_tsize;       /* size of text */

        /* controlling tty info */
        unsigned long   pi_ttyp;        /* has a controlling terminal */
        unsigned long   pi_ttyd;        /* controlling terminal */
        unsigned long   pi_ttympx;      /*      "         "     channel */
        unsigned long   pi_dsize;       /* current break value */
        unsigned long   pi_sdsize;      /* data size from shared library */
        char            pi_comm[MAXCOMLEN+1]; /* (truncated) program name */

        /* memory usage info */
        unsigned long   pi_drss;        /* data resident set size */
        unsigned long   pi_trss;        /* text resident set size */
        unsigned long   pi_dvm;         /* data virtual memory size */
        unsigned long   pi_prm;         /* percent real memory usage */

2. FTP Mirroring

3. Binary size vs memory size

4. aolinux?

5. size(/proc/kcore) != size (physical memory) in linux 2.4.20

6. Java applets & netscape 3.0

7. storage size and memory size queries

8. xterm window title

9. Size max files based on memory size

10. maximum disk request size and memory alllocation size

11. "increased VM size+Main-memory" better than "Main-memory+Hard-disk" ??

12. How to find out the memory size used by a process or check its memory leaking?

13. Array size in Fortran (f2c) and ELF