Bug 1441335 - Fix base allocator commit evaluation. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 27 Feb 2018 07:39:34 +0900
changeset 760156 80ad49ef0f094738100bda100f93e92a1c643910
parent 759182 ad3c6f89d67752309a473e57a47fb88f9da37683
push id100556
push userbmo:mh+mozilla@glandium.org
push dateMon, 26 Feb 2018 22:44:06 +0000
reviewersnjn
bugs1441335, 515556
milestone60.0a1
Bug 1441335 - Fix base allocator commit evaluation. r?njn Base allocator commit stats were added in bug 515556, along other commit stats, but they have actually been wrong since then: the committed count is updated with the difference between pbase_next_addr and base_next_decommitted *after* the latter is set to the former, making the difference always 0.
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -1439,19 +1439,19 @@ base_alloc(size_t aSize)
 
 #ifdef MALLOC_DECOMMIT
     if (!pages_commit(base_next_decommitted,
                       (uintptr_t)pbase_next_addr -
                         (uintptr_t)base_next_decommitted)) {
       return nullptr;
     }
 #endif
-    base_next_decommitted = pbase_next_addr;
     base_committed +=
       (uintptr_t)pbase_next_addr - (uintptr_t)base_next_decommitted;
+    base_next_decommitted = pbase_next_addr;
   }
 
   return ret;
 }
 
 static void*
 base_calloc(size_t aNumber, size_t aSize)
 {