diff --git a/CleanSpec.mk b/CleanSpec.mk index b84e1b65e..841ad16c0 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -44,6 +44,10 @@ #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) +# Switching to jemalloc requires deleting these files. +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libc_*) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libc_*) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/libc/Android.mk b/libc/Android.mk index 5acdd6b89..765f4d2a0 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -515,12 +515,13 @@ ifeq ($(strip $(DEBUG_BIONIC_LIBC)),true) libc_common_cflags += -DDEBUG endif -ifeq ($(MALLOC_IMPL),jemalloc) - libc_common_cflags += -DUSE_JEMALLOC - libc_malloc_src := bionic/jemalloc_wrapper.cpp -else +ifeq ($(MALLOC_IMPL),dlmalloc) libc_common_cflags += -DUSE_DLMALLOC libc_malloc_src := bionic/dlmalloc.c +else + libc_common_cflags += -DUSE_JEMALLOC + libc_malloc_src := bionic/jemalloc_wrapper.cpp + libc_common_c_includes += external/jemalloc/include endif # To customize dlmalloc's alignment, set BOARD_MALLOC_ALIGNMENT in @@ -547,14 +548,10 @@ libc_common_cppflags := \ # Define some common includes # ======================================================== -libc_common_c_includes := \ +libc_common_c_includes += \ $(LOCAL_PATH)/stdlib \ $(LOCAL_PATH)/stdio \ -ifeq ($(MALLOC_IMPL),jemalloc) - libc_common_c_includes += external/jemalloc/include -endif - # ======================================================== # Add in the arch-specific flags. # Must be called with $(eval). @@ -873,7 +870,7 @@ LOCAL_WHOLE_STATIC_LIBRARIES := \ LOCAL_WHOLE_STATIC_LIBRARIES_arm := libc_aeabi -ifeq ($(MALLOC_IMPL),jemalloc) +ifneq ($(MALLOC_IMPL),dlmalloc) LOCAL_WHOLE_STATIC_LIBRARIES += libjemalloc endif diff --git a/tests/Android.mk b/tests/Android.mk index 278511b05..3e8fbe664 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -40,7 +40,9 @@ test_cflags = \ test_cflags += -D__STDC_LIMIT_MACROS # For glibc. -ifeq ($(MALLOC_IMPL),jemalloc) +ifeq ($(MALLOC_IMPL),dlmalloc) +test_cflags += -DUSE_DLMALLOC +else test_cflags += -DUSE_JEMALLOC endif @@ -115,10 +117,10 @@ libBionicStandardTests_src_files := \ libBionicStandardTests_cflags := \ $(test_cflags) \ -ifeq ($(MALLOC_IMPL),jemalloc) - libBionicStandardTests_cflags += -DUSE_JEMALLOC -else +ifeq ($(MALLOC_IMPL),dlmalloc) libBionicStandardTests_cflags += -DUSE_DLMALLOC +else + libBionicStandardTests_cflags += -DUSE_JEMALLOC endif libBionicStandardTests_cppflags := \