Bug 1365194 - Remove MOZ_JEMALLOC_API from _malloc_options and _malloc_message. r?njn draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 16 May 2017 18:55:24 +0900
changeset 579108 b8feda96500aced1862648e3b6ff42bf4cae1ad3
parent 579107 52f424b3bad91fd7c50d314e367a6299bcd92a48
child 579109 0f622e48d693df535e7848e0ab2e749853895952
push id59148
push userbmo:mh+mozilla@glandium.org
push dateWed, 17 May 2017 00:43:10 +0000
reviewersnjn
bugs1365194
milestone55.0a1
Bug 1365194 - Remove MOZ_JEMALLOC_API from _malloc_options and _malloc_message. r?njn MOZ_JEMALLOC_API makes those symbols exported, but we're going to make MOZ_JEMALLOC_API include `extern "C"`, which GCC warns about in this case (can't use extern on a variable that is initialized). While we could get around this in some way, there is not much use for those variables being exported altogether: the only reason they are is to allow an override when linking mozjemalloc into executables, but doing that in Firefox requires patching the build system or passing some specific LDFLAGS. People who really need to do that might as well apply a patch. They also allow run-time override through LD_PRELOAD, but one might as well use the MALLOC_OPTIONS environment variable for _malloc_options. As for _malloc_message, it doesn't seem very useful to override, and probably noone ever overrode it at runtime. Note, we may want to remove them in a followup.
memory/mozjemalloc/jemalloc.c
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -1072,17 +1072,16 @@ static malloc_spinlock_t arenas_lock; /*
 static __thread arena_t	*arenas_map;
 #endif
 #endif
 
 /*******************************/
 /*
  * Runtime configuration options.
  */
-MOZ_JEMALLOC_API
 const char	*_malloc_options = MOZ_MALLOC_OPTIONS;
 
 #ifndef MALLOC_PRODUCTION
 static bool	opt_abort = true;
 static bool	opt_junk = true;
 static bool	opt_poison = true;
 static bool	opt_zero = false;
 #else
@@ -1269,17 +1268,16 @@ wrtmessage(const char *p1, const char *p
 	if (_write(STDERR_FILENO, p2, (unsigned int) strlen(p2)) < 0)
 		return;
 	if (_write(STDERR_FILENO, p3, (unsigned int) strlen(p3)) < 0)
 		return;
 	if (_write(STDERR_FILENO, p4, (unsigned int) strlen(p4)) < 0)
 		return;
 }
 
-MOZ_JEMALLOC_API
 void	(*_malloc_message)(const char *p1, const char *p2, const char *p3,
 	    const char *p4) = wrtmessage;
 
 #include "mozilla/Assertions.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/TaggedAnonymousMemory.h"
 // Note: MozTaggedAnonymousMmap() could call an LD_PRELOADed mmap
 // instead of the one defined here; use only MozTagAnonymousMemory().