mountlist: add support for Interix
[gnulib.git] / lib / get-rusage-as.c
index 3ca1366..7ab1c93 100644 (file)
@@ -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;