This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Top reports wrong memoryuse


On Jul 21 19:21, Bengt-Arne Fjellner wrote:
> Hi first of all thanks for a wonderful set of programs.
> 
> Now the problem:
> Top reports 16*the memory used for a process. Also in percent its wrong.
> It uses the pagesize from getpagesize()*first field of /proc/*/statm
> Which is wrong /proc/*/statm or top or getpagesize ?

top is wrong.  It uses the return value of getpagesize() as if its
meaning is the physical page size of the underlying architecture.  But
the definition of getpagesize() and its successor sysconf(_SC_PAGESIZE)
is to return the number of bytes per page, as defined in the mmap(2)
call.  mmap uses pages of 64K due to constraints in the win32 memory
management.  Consequentially this is returned by getpagesize resp.
sysconf(_SC_PAGESIZE).  The values in /proc/*/stat{m} are using the
physical page size of 4K.  Unfortunately there's no function which
returns the physical page size so top would just have to know.

It would be possible to change /proc/*/stat{m} to use the page size
of 64K, but this would make the values in those files imprecise.  It
might be better just to change top.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]