X-Spam-Check-By: sourceware.org Date: Mon, 24 Jul 2006 12:01:56 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Top reports wrong memoryuse Message-ID: <20060724100156.GB12496@calimero.vinschen.de> Mail-Followup-To: cygwin AT cygwin DOT com References: <4411 DOT 130 DOT 240 DOT 136 DOT 130 DOT 1153502481 DOT squirrel AT pinus DOT tt DOT luth DOT se> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4411.130.240.136.130.1153502481.squirrel@pinus.tt.luth.se> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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/