Merge m-c to inbound. a=merge
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 05 Jul 2017 12:59:23 -0400
changeset 367463 11a7e159e79f2e32a6462f76995ff95f42c96db2
parent 367462 094ea9f8029b596b43e6b3ccabfd7584db3ad9e5 (current diff)
parent 367368 11755fd63168581e194258d04bb6a7337779ec78 (diff)
child 367464 b3884b662c0e43f47dc6d1cf336d6e9f6ff95cf0
push id32135
push userkwierso@gmail.com
push dateThu, 06 Jul 2017 00:12:17 +0000
treeherdermozilla-central@af0466865a21 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge m-c to inbound. a=merge
--- a/memory/build/mozmemory_wrap.c
+++ b/memory/build/mozmemory_wrap.c
@@ -63,16 +63,17 @@ mozmem_malloc_impl(_ZdaPvRKSt9nothrow_t)
 }
 #endif
 
 /* strndup and strdup may be defined as macros in string.h, which would
  * clash with the definitions below. */
 #undef strndup
 #undef strdup
 
+#ifndef XP_DARWIN
 MOZ_MEMORY_API char *
 strndup_impl(const char *src, size_t len)
 {
   char* dst = (char*) malloc_impl(len + 1);
   if (dst) {
     strncpy(dst, src, len);
     dst[len] = '\0';
   }
@@ -80,16 +81,17 @@ strndup_impl(const char *src, size_t len
 }
 
 MOZ_MEMORY_API char *
 strdup_impl(const char *src)
 {
   size_t len = strlen(src);
   return strndup_impl(src, len);
 }
+#endif /* XP_DARWIN */
 
 #ifdef ANDROID
 #include <stdarg.h>
 #include <stdio.h>
 
 MOZ_MEMORY_API int
 vasprintf_impl(char **str, const char *fmt, va_list ap)
 {
--- a/memory/build/mozmemory_wrap.h
+++ b/memory/build/mozmemory_wrap.h
@@ -48,20 +48,21 @@
  *   specific functions are left unprefixed. All these functions are however
  *   aliased when exporting them, such that the resulting mozglue.dll exports
  *   them unprefixed (see $(topsrcdir)/mozglue/build/mozglue.def.in). The
  *   prefixed malloc implementation and duplication functions are not
  *   exported.
  *
  * - On MacOSX, the system libc has a zone allocator, which allows us to
  *   hook custom malloc implementation functions without exporting them.
- *   However, since we want things in Firefox to skip the system zone
- *   allocator, the malloc implementation functions are all exported
- *   unprefixed, as well as duplication functions.
- *   Jemalloc-specific functions are also left unprefixed.
+ *   The malloc implementation functions are all prefixed with "je_" and used
+ *   this way from the custom zone allocator. They are not exported.
+ *   Duplication functions are not included, since they will call the custom
+ *   zone allocator anyways. Jemalloc-specific functions are also left
+ *   unprefixed.
  *
  * - On Android and Gonk, all functions are left unprefixed. Additionally,
  *   C++ allocation functions (operator new/delete) are also exported and
  *   unprefixed.
  *
  * - On other systems (mostly Linux), all functions are left unprefixed.
  *
  * Only Android and Gonk add C++ allocation functions.
@@ -128,17 +129,17 @@
 #endif
 
 #ifdef MOZ_MEMORY_IMPL
 #  if defined(MOZ_JEMALLOC_IMPL) && defined(MOZ_REPLACE_MALLOC)
 #    define mozmem_malloc_impl(a)     je_ ## a
 #    define mozmem_jemalloc_impl(a)   je_ ## a
 #  else
 #    define MOZ_JEMALLOC_API MOZ_EXTERN_C MFBT_API
-#    if defined(XP_WIN)
+#    if (defined(XP_WIN) || defined(XP_DARWIN))
 #      if defined(MOZ_REPLACE_MALLOC)
 #        define mozmem_malloc_impl(a)   a ## _impl
 #      else
 #        define mozmem_malloc_impl(a)   je_ ## a
 #      endif
 #    else
 #      define MOZ_MEMORY_API MOZ_EXTERN_C MFBT_API
 #      if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)