Bug 1413475 - Move MALLOC_DECOMMIT definition closer to that of MALLOC_DOUBLE_PURGE. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 01 Nov 2017 16:45:24 +0900
changeset 690336 4224bb67cbbeda248aa81b1be017bc2d846b42da
parent 690335 ea2f3f7f1bb01471a3ed2f41a1d54a42d624e712
child 690337 58ea2ee542df22f2ef5e6f84d82e2e0958ea6bc7
push id87285
push userbmo:mh+mozilla@glandium.org
push dateWed, 01 Nov 2017 22:04:01 +0000
reviewersnjn
bugs1413475
milestone58.0a1
Bug 1413475 - Move MALLOC_DECOMMIT definition closer to that of MALLOC_DOUBLE_PURGE. r?njn
memory/build/mozjemalloc.cpp
--- a/memory/build/mozjemalloc.cpp
+++ b/memory/build/mozjemalloc.cpp
@@ -166,17 +166,20 @@ using namespace mozilla;
 // The jemalloc_purge_freed_pages definition in memory/build/mozmemory.h needs
 // to be adjusted if MALLOC_DOUBLE_PURGE is ever enabled on Linux.
 
 #ifdef XP_DARWIN
 #define MALLOC_DOUBLE_PURGE
 #endif
 
 #ifdef XP_WIN
-
+#define MALLOC_DECOMMIT
+#endif
+
+#ifdef XP_WIN
 #define STDERR_FILENO 2
 
 // Implement getenv without using malloc.
 static char mozillaMallocOptionsBuf[64];
 
 #define getenv xgetenv
 static char*
 getenv(const char* name)
@@ -184,18 +187,16 @@ getenv(const char* name)
 
   if (GetEnvironmentVariableA(
         name, mozillaMallocOptionsBuf, sizeof(mozillaMallocOptionsBuf)) > 0) {
     return mozillaMallocOptionsBuf;
   }
 
   return nullptr;
 }
-
-#define MALLOC_DECOMMIT
 #endif
 
 #ifndef XP_WIN
 #ifndef MADV_FREE
 #define MADV_FREE MADV_DONTNEED
 #endif
 #ifndef MAP_NOSYNC
 #define MAP_NOSYNC 0