The sbrk value only includes the data segment, and does not include
anonymous memory allocated via mmap() such as done by malloc() if
allocating above the mmap threshold (differs from malloc implementation,
but do not assume malloc sizes above 4K will be included in the data
segment/sbrk)
ps reports the size including memory allocated by mmap(), stack, data,
..... Well, what PS reports also depends on what you ask for (total
process sice, resident size, data size, size including/excluding shared
libraries, ...)
one could think getrusage maxrss would find a value close to the
resident size on most systems, but it obviously varies from system to
system. Not sure if there is a uniform standard definition of what
"Maximum Resident Set Size" really is representing..
Regards
Henrik
wessels@squid-cache.org wrote:
>
> wessels 2003/01/10 10:52:54 MST
>
> Modified files:
> . configure.in
> Log:
> added reporting of "Process Data Segment Size via sbrk()" when
> sbrk() call exists. According to the sbrk() man page, calling
> sbrk(0) returns the end of the data segment. By storing the data
> segment offset when Squid starts, we can report the size of the
> data segment at any time. This might be a better metric than
> getrusage()'s MAX RSS, which, in my experience, is often less than
> the process size reported by 'ps' (presumably because some of the
> processes memory is swapped to disk). However, initial tests show that
> the sbrk() trick reports a value slightly smaller than reported by
> 'ps'.
>
> Revision Changes Path
> 1.297 +1 -0 squid/configure.in
Received on Fri Jan 10 2003 - 14:56:47 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:19:06 MST