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.
--- 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)
{