[PATCH] fix for process virtual size display

Christopher Faylor cgf@redhat.com
Fri May 9 15:06:00 GMT 2003


On Fri, May 09, 2003 at 11:04:27AM -0400, Joe Buehler wrote:
>I offer this trivial patch as a possible fix for "top" displaying
>~400 megabytes as the virtual memory size for all processes.  This
>happens because the WIN32 info used appears to refer to "reserved"
>memory, not "committed", and Cygwin processes have about 400 megabytes
>reserved by default (for the stack and/or heap, I forget at the moment).
>
>Whether this is the right thing to do, I don't know.  The sizes
>shown by "top" are now slightly smaller than the working set size.
>Perhaps due to the way that dlls are counted in the two numbers?
>
>Anyway, I offer this if it looks better than current behavior.
>
>2003-05-09  Joe Buehler  <jhpb@draco.hekimian.com>
>
>	* fhandler_process.cc (format_process_stat): use PagefileUsage 
>	instead of VirtualSize
>	(get_mem_values): Ditto.

Looks good to me but I'd like Chris January to comment since this is his
code.

cgf

>Index: fhandler_process.cc
>===================================================================
>RCS file: /cvs/src/src/winsup/cygwin/fhandler_process.cc,v
>retrieving revision 1.32
>diff -u -r1.32 fhandler_process.cc
>--- fhandler_process.cc	1 Apr 2003 16:11:41 -0000	1.32
>+++ fhandler_process.cc	9 May 2003 14:54:39 -0000
>@@ -475,7 +474,7 @@
> 	 start_time = (spt.KernelTime.QuadPart + spt.UserTime.QuadPart) * HZ 
> 	 / 10000000ULL;
>        priority = pbi.BasePriority;
>        unsigned page_size = getpagesize ();
>-       vmsize = vmc.VirtualSize;
>+       vmsize = vmc.PagefileUsage;
>        vmrss = vmc.WorkingSetSize / page_size;
>        vmmaxrss = ql.MaximumWorkingSetSize / page_size;
>     }
>@@ -740,7 +743,7 @@
>       res = false;
>       goto out;
>     }
>-  *vmsize = vmc.VirtualSize / page_size;
>+  *vmsize = vmc.PagefileUsage / page_size;
> out:
>   delete [] p;
>   CloseHandle (hProcess);
>-- 
>Joe Buehler



More information about the Cygwin-patches mailing list