Bug 1418104 - Initialize the allocator in jemalloc_stats. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 16 Nov 2017 16:35:03 +0900
changeset 699258 eeb381e56b2bfc266c880b2d58d0399434547164
parent 699096 a3f183201f7f183c263d554bfb15fbf0b0ed2ea4
child 699259 fbb546fccb61c6f13cbf70c456d0fc4d3b42df17
child 699285 337e40ca1b9284e067a2c97a254f48e94de20155
child 699296 ad84eaab12d8c192b51f3511443279415cb850bc
push id89516
push userbmo:mh+mozilla@glandium.org
push dateThu, 16 Nov 2017 22:41:39 +0000
reviewersnjn
bugs1418104
milestone59.0a1
Bug 1418104 - Initialize the allocator in jemalloc_stats. r?njn Some unit tests rely on jemalloc_stats to get information such as chunk size or page size. They can do so before any allocation happens, when using gtest filters. So it is preferable for jemalloc_stats to initialize the allocator.
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -4465,17 +4465,17 @@ template<>
 inline void
 MozJemalloc::jemalloc_stats(jemalloc_stats_t* aStats)
 {
   size_t non_arena_mapped, chunk_header_size;
 
   if (!aStats) {
     return;
   }
-  if (!malloc_initialized) {
+  if (!malloc_init()) {
     memset(aStats, 0, sizeof(*aStats));
     return;
   }
 
   // Gather runtime settings.
   aStats->opt_junk = opt_junk;
   aStats->opt_zero = opt_zero;
   aStats->quantum = kQuantum;