diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index 52526484d50..2f665df8e16 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -73,7 +73,7 @@ GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(LIBX DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID) ifdef MOZ_MEMORY -ifneq ($(OS_ARCH),WINNT) +ifeq ($(OS_ARCH),Darwin) LIBS += -ljemalloc endif endif diff --git a/browser/installer/removed-files.in b/browser/installer/removed-files.in index f0e4438d8ad..3c12a9c328c 100644 --- a/browser/installer/removed-files.in +++ b/browser/installer/removed-files.in @@ -589,6 +589,7 @@ res/bloatcycle.html #ifndef XP_MACOSX readme.txt chrome/icons/default/default.xpm +libjemalloc.so #endif #endif dictionaries/PL.dic diff --git a/browser/installer/unix/packages-static b/browser/installer/unix/packages-static index 4096dfe0a1a..d420205d677 100644 --- a/browser/installer/unix/packages-static +++ b/browser/installer/unix/packages-static @@ -51,7 +51,6 @@ bin/run-mozilla.sh bin/plugins/libnullplugin.so bin/libsqlite3.so bin/README.txt -bin/libjemalloc.so ; [Components] bin/components/alerts.xpt diff --git a/memory/jemalloc/Makefile.in b/memory/jemalloc/Makefile.in index 45052bada93..c1d998f577b 100644 --- a/memory/jemalloc/Makefile.in +++ b/memory/jemalloc/Makefile.in @@ -81,11 +81,18 @@ libs:: $(WIN32_CUSTOM_CRT_DIR)/mozcrt19.dll endif else -# for other platforms, just build jemalloc as a shared lib MODULE_OPTIMIZE_FLAGS = -O2 LIBRARY_NAME = jemalloc + +ifeq (Darwin,$(OS_TARGET)) +# Build jemalloc as a shared lib, so that the library init function is executed. FORCE_SHARED_LIB= 1 +else +# Make jemalloc part of libxul, in order to reduce dynamic loading overhead. +MODULE = jemalloc +LIBXUL_LIBRARY = 1 +endif CSRCS = \ jemalloc.c \ diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index 12e18269f39..8f98a086ed8 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -249,3 +249,11 @@ endif ifneq (,$(filter layout-debug,$(MOZ_EXTENSIONS))) DEFINES += -DMOZ_ENABLE_EXTENSION_LAYOUT_DEBUG endif + +ifdef MOZ_MEMORY +ifneq ($(OS_ARCH),WINNT) +ifneq ($(OS_ARCH),Darwin) +EXTRA_DSO_LDOPTS += $(DEPTH)/memory/jemalloc/$(LIB_PREFIX)jemalloc.$(LIB_SUFFIX) +endif +endif +endif