Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

memory usage of a process (linux)

592 views
Skip to first unread message

Selva

unread,
Feb 29, 2012, 6:30:43 PM2/29/12
to
Some questions:

1)
What is difference between (assuming we convert all values to same
units):
a) /proc/PID/statm's totalpages
b) /proc/PID/stat 's vsize
c) /proc/PID/status's VmSize
?

2) Where in /proc can I get the heap size of a process?

Thanks

Johann Klammer

unread,
Mar 1, 2012, 11:30:43 AM3/1/12
to
Selva wrote:
> Some questions:
>
> 1)
> What is difference between (assuming we convert all values to same
> units):

Read <kerneldir>/Documentation/filesystems/proc.txt yet?

> a) /proc/PID/statm's totalpages
Table 1-3: Contents of the statm files (as of 2.6.8-rc3)
..............................................................................
Field Content
size total program size (pages) (same as VmSize in status)
resident size of memory portions (pages) (same as VmRSS in status)
shared number of pages that are shared (i.e. backed by a file)
trs number of pages that are 'code' (not including libs; broken,
includes data segment)
lrs number of pages of library (always 0 on 2.6)
drs number of pages of data/stack (including libs; broken,
includes library text)
dt number of dirty pages (always 0 on 2.6)
..............................................................................

> b) /proc/PID/stat 's vsize

Table 1-4: Contents of the stat files (as of 2.6.30-rc7)
..............................................................................
Field Content
pid process id
tcomm filename of the executable
state state (R is running, S is sleeping, D is sleeping in an
uninterruptible wait, Z is zombie, T is traced or stopped)
ppid process id of the parent process
pgrp pgrp of the process
sid session id
tty_nr tty the process uses
tty_pgrp pgrp of the tty
flags task flags
min_flt number of minor faults
cmin_flt number of minor faults with child's
maj_flt number of major faults
cmaj_flt number of major faults with child's
utime user mode jiffies
stime kernel mode jiffies
cutime user mode jiffies with child's
cstime kernel mode jiffies with child's
priority priority level
nice nice level
num_threads number of threads
it_real_value (obsolete, always 0)
start_time time the process started after system boot
vsize virtual memory size
rss resident set memory size
rsslim current limit in bytes on the rss
start_code address above which program text can run
end_code address below which program text can run
start_stack address of the start of the stack
esp current value of ESP
eip current value of EIP
pending bitmap of pending signals
blocked bitmap of blocked signals
sigign bitmap of ignored signals
sigcatch bitmap of catched signals
wchan address where process went to sleep
0 (place holder)
0 (place holder)
exit_signal signal to send to parent thread on exit
task_cpu which CPU the task is scheduled on
rt_priority realtime priority
policy scheduling policy (man sched_setscheduler)
blkio_ticks time spent waiting for block IO
gtime guest time of the task in jiffies
cgtime guest time of the task children in jiffies
..............................................................................


> c) /proc/PID/status's VmSize
From further up:

size total program size (pages) (same as VmSize in status)


> ?
>
> 2) Where in /proc can I get the heap size of a process?

Try:
/proc/PID/smaps
It lists all mapped areas of the process and how it is used.


look for a line ending in [heap]

>
> Thanks

0 new messages