Bug 743715 - Cannot build Fennec without jemalloc. r=glandium
authorGian-Carlo Pascutto <gpascutto@mozilla.com>
Wed, 11 Apr 2012 14:12:34 +0200
changeset 91429 5fcd261121c303caf581ef011398365eba86e151
parent 91428 966e23109ac29990428dccec6b269a6945bb5b48
child 91430 4dc5567fc431d584cd0f95283469a3d30c4b5524
push id672
push usertim.taubert@gmx.de
push dateFri, 13 Apr 2012 10:22:59 +0000
treeherderfx-team@cb2e81306595 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs743715
milestone14.0a1
Bug 743715 - Cannot build Fennec without jemalloc. r=glandium
memory/mozalloc/mozalloc.cpp
mozglue/android/nsGeckoUtils.cpp
--- a/memory/mozalloc/mozalloc.cpp
+++ b/memory/mozalloc/mozalloc.cpp
@@ -238,20 +238,18 @@ moz_valloc(size_t size)
 size_t
 moz_malloc_usable_size(void *ptr)
 {
     if (!ptr)
         return 0;
 
 #if defined(XP_MACOSX)
     return malloc_size(ptr);
-#elif defined(MOZ_MEMORY) || defined(XP_LINUX)
-    // XXX: the |defined(XP_LINUX)| may be too lax;  some Linux installations
-    // might use a libc that doesn't have malloc_usable_size.  Let's fix this
-    // if/when it happens.
+#elif defined(MOZ_MEMORY) || (defined(XP_LINUX) && !defined(ANDROID))
+    // Android bionic libc doesn't have malloc_usable_size.
     return malloc_usable_size(ptr);
 #elif defined(XP_WIN)
     return _msize(ptr);
 #else
     return 0;
 #endif
 }
 
--- a/mozglue/android/nsGeckoUtils.cpp
+++ b/mozglue/android/nsGeckoUtils.cpp
@@ -31,21 +31,26 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <jni.h>
+
+#ifdef MOZ_MEMORY
 // Wrap malloc and free to use jemalloc
 #define malloc __wrap_malloc
 #define free __wrap_free
+#endif
+
 #include <stdlib.h>
 
+
 extern "C"
 __attribute__ ((visibility("default")))
 void JNICALL
 Java_org_mozilla_gecko_GeckoAppShell_putenv(JNIEnv *jenv, jclass, jstring map)
 {
     const char* str;
     // XXX: java doesn't give us true UTF8, we should figure out something 
     // better to do here