From 85570b0dcffcbd7c3a13a417a083a728d83078ca Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 18 Jan 2011 19:47:37 +0100 Subject: [PATCH] get-rusage-as: Improvement for Cygwin. * lib/get-rusage-as.c (get_rusage_as_via_iterator): On Windows, ignore areas that are merely reserved. --- ChangeLog | 6 ++++++ lib/get-rusage-as.c | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 783de42c1..f99711917 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-01-18 Bruno Haible + + get-rusage-as: Improvement for Cygwin. + * lib/get-rusage-as.c (get_rusage_as_via_iterator): On Windows, ignore + areas that are merely reserved. + 2011-01-18 Paul Eggert strftime: remove dependencies on multibyte modules diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c index 3ca136600..7ab1c9315 100644 --- a/lib/get-rusage-as.c +++ b/lib/get-rusage-as.c @@ -653,7 +653,11 @@ get_rusage_as_via_iterator (void) while (VirtualQuery ((void*)address, &info, sizeof(info)) == sizeof(info)) { if (info.State != MEM_FREE) - total += info.RegionSize; + /* Ignore areas where info.Protect has the undocumented value 0. + This is needed, so that on Cygwin, areas used by malloc() are + distinguished from areas reserved for future malloc(). */ + if (info.Protect != 0) + total += info.RegionSize; address = (unsigned long)info.BaseAddress + info.RegionSize; } return total; -- 2.11.0