Bug 1365460 - Remove the inline extra malloc options. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 18 May 2017 10:06:29 +0900
changeset 580750 b6f40047fb381fd48c17853096039becb7830a49
parent 580749 f9fb0357a5970311decd7bb45a7eccc716bda2a3
child 580751 0d0c88adb0bcc543ac5149c95f6663c3343984b9
push id59654
push userbmo:mh+mozilla@glandium.org
push dateThu, 18 May 2017 22:44:22 +0000
reviewersnjn
bugs1365460
milestone55.0a1
Bug 1365460 - Remove the inline extra malloc options. r?njn Those options, complementing the MALLOC_OPTIONS environment variable, were always empty since the removal of b2g.
memory/mozjemalloc/mozjemalloc.cpp
--- a/memory/mozjemalloc/mozjemalloc.cpp
+++ b/memory/mozjemalloc/mozjemalloc.cpp
@@ -136,28 +136,16 @@
  * MALLOC_PRODUCTION disables assertions and statistics gathering.  It also
  * defaults the A and J runtime options to off.  These settings are appropriate
  * for production systems.
  */
 #ifndef MOZ_MEMORY_DEBUG
 #  define	MALLOC_PRODUCTION
 #endif
 
-/*
- * Pass this set of options to jemalloc as its default. It does not override
- * the options passed via the MALLOC_OPTIONS environment variable but is
- * applied in addition to them.
- */
-#ifdef MOZ_WIDGET_GONK
-    /* Reduce the amount of unused dirty pages to 1MiB on B2G */
-#   define MOZ_MALLOC_OPTIONS "ff"
-#else
-#   define MOZ_MALLOC_OPTIONS ""
-#endif
-
 #ifndef MALLOC_PRODUCTION
    /*
     * MALLOC_DEBUG enables assertions and other sanity checks, and disables
     * inline functions.
     */
 #  define MALLOC_DEBUG
 
    /* Support optional abort() on OOM. */
@@ -1070,18 +1058,16 @@ static malloc_spinlock_t arenas_lock; /*
 static __thread arena_t	*arenas_map;
 #endif
 #endif
 
 /*******************************/
 /*
  * Runtime configuration options.
  */
-const char	*_malloc_options = MOZ_MALLOC_OPTIONS;
-
 const uint8_t kAllocJunk = 0xe4;
 const uint8_t kAllocPoison = 0xe5;
 
 #ifndef MALLOC_PRODUCTION
 static bool	opt_abort = true;
 static bool	opt_junk = true;
 static bool	opt_zero = false;
 #else
@@ -4755,17 +4741,17 @@ malloc_init_hard(void)
 		moz_abort();
 	}
 #else
 	pagesize = (size_t) result;
 	pagesize_mask = (size_t) result - 1;
 	pagesize_2pow = ffs((int)result) - 1;
 #endif
 
-	for (i = 0; i < 3; i++) {
+	for (i = 0; i < 2; i++) {
 		unsigned j;
 
 		/* Get runtime configuration. */
 		switch (i) {
 		case 0:
 #ifndef MOZ_MEMORY_WINDOWS
 			if ((linklen = readlink("/etc/malloc.conf", buf,
 						sizeof(buf) - 1)) != -1) {
@@ -4791,29 +4777,16 @@ malloc_init_hard(void)
 				 * variable.
 				 */
 			} else {
 				/* No configuration specified. */
 				buf[0] = '\0';
 				opts = buf;
 			}
 			break;
-		case 2:
-			if (_malloc_options != NULL) {
-				/*
-				 * Use options that were compiled into the
-				 * program.
-				 */
-				opts = _malloc_options;
-			} else {
-				/* No configuration specified. */
-				buf[0] = '\0';
-				opts = buf;
-			}
-			break;
 		default:
 			/* NOTREACHED */
 			buf[0] = '\0';
 			opts = buf;
 			assert(false);
 		}
 
 		for (j = 0; opts[j] != '\0'; j++) {