Hi all,

         How can I find the exact amount of memory consumed by a process in 
linux? 

         The scenario is this. I ran a process 'test', which had some shared 
libraries. When a single instance of  the process was running, the available 
free memory(shown in output of free command) was around 50MB and when I ran 
another instance of it, the free memory reduced to 45MB. The /proc/status 
entries were showing the VmRSS size of the new instance as 10444 kB.   

VmSize:    21768 kB
 VmLck:         0 kB
 VmRSS:     10444 kB
 VmData:     3876 kB
 VmStk:        32 kB
 VmExe:        68 kB
 VmLib:     10972 kB
         
           Can I assume that the actual memory consumed by the new instance of 
the process includes only the size of data, stack and the exe segments 
(presuming that the VmLib can be ignored, as shared libraries won't be copied 
again) ?  If so, in this example, they add up to nearly 4 MB (3876+32+68). But 
the reduction in free memory size was nearly 5 MB. How can this extra 1 MB be 
accounted? Am I missing something here?  What exactly constitutes the VmRSS 
size? Also please let me know, where I can find more details about the fields 
in /proc/status. man is not providing much help in this scenario.
                           
Thanks,
Harish

Capture of the terminal, where I tried this:
---------------------------------------------------------
[EMAIL PROTECTED] root]# free
                 total         used         free       shared      buffers
  Mem:       128112        77496        50616            0          264
 Swap:            0            0            0
Total:       128112        77496        50616

[EMAIL PROTECTED] root]#cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  131186688 79368192 51818496        0   270336 43704320
Swap:        0        0        0
MemTotal:       128112 kB
MemFree:         50604 kB
MemShared:           0 kB
Buffers:           264 kB
Cached:          42680 kB
SwapCached:          0 kB
Active:          53708 kB
Inactive:        12716 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       128112 kB
LowFree:         50604 kB
SwapTotal:           0 kB
SwapFree:            0 kB

[EMAIL PROTECTED] root]# ps | grep test
  762 root      10804 S   test
17919 root        424 S   grep test

[EMAIL PROTECTED] root]# cat /proc/762/status
Name:   test
State:  S (sleeping)
Tgid:   762
Pid:    762
PPid:   760
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 32
Groups:
VmSize:    21880 kB
VmLck:         0 kB
VmRSS:     10804 kB
VmData:     3972 kB
VmStk:        48 kB
VmExe:        68 kB
VmLib:     10972 kB
SigPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000010000080006
SigCgt: 0000000008005a01
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff

[EMAIL PROTECTED] root]# test&

[EMAIL PROTECTED] root]# free
              total         used         free       shared      buffers
  Mem:       128112        82432        45680            0          264
 Swap:            0            0            0
Total:       128112        82432        45680

[EMAIL PROTECTED] root]#cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  131186688 84398080 46788608        0   270336 43704320
Swap:        0        0        0
MemTotal:       128112 kB
MemFree:         45692 kB
MemShared:           0 kB
Buffers:           264 kB
Cached:          42680 kB
SwapCached:          0 kB
Active:          53716 kB
Inactive:        17580 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:       128112 kB
LowFree:         45692 kB
SwapTotal:           0 kB
SwapFree:            0 kB

[EMAIL PROTECTED] root]# ps | grep test
  762 root      10804 S   test 
17927 root      10444 S   test
17970 root        424 S   grep test

[EMAIL PROTECTED] root]# cat /proc/17927/status
Name:   test
State:  S (sleeping)
Tgid:   17927
Pid:    17927
PPid:   17804
TracerPid:      0
Uid:    0       0       0       0
Gid:    0       0       0       0
FDSize: 32
Groups:
VmSize:    21768 kB
VmLck:         0 kB
VmRSS:     10444 kB
VmData:     3876 kB
VmStk:        32 kB
VmExe:        68 kB
VmLib:     10972 kB
SigPnd: 0000000000000000
SigBlk: 0000000000010000
SigIgn: 0000010000080006
SigCgt: 0000000008005a01
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff


       
---------------------------------
 Download prohibited? No problem. CHAT from any browser, without download.

[Non-text portions of this message have been removed]

Reply via email to