diff options
author | Bruno Haible <bruno@clisp.org> | 2011-01-18 19:47:37 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2011-01-18 19:47:37 +0100 |
commit | 85570b0dcffcbd7c3a13a417a083a728d83078ca (patch) | |
tree | c7b69fff51789a73d78ea59da278fbd149f8160c /lib/get-rusage-as.c | |
parent | 1c4cf2052ce432fb10a5405879f3b4d8f672e81c (diff) | |
download | gnulib-85570b0dcffcbd7c3a13a417a083a728d83078ca.tar.gz |
get-rusage-as: Improvement for Cygwin.
* lib/get-rusage-as.c (get_rusage_as_via_iterator): On Windows, ignore
areas that are merely reserved.
Diffstat (limited to 'lib/get-rusage-as.c')
-rw-r--r-- | lib/get-rusage-as.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c index 3ca1366008..7ab1c93153 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; |