diff --git a/storage/src/Makefile.in b/storage/src/Makefile.in index 43c9ee9dcef..3ce9543b7ff 100644 --- a/storage/src/Makefile.in +++ b/storage/src/Makefile.in @@ -55,6 +55,18 @@ ifeq ($(OS_ARCH),Linux) DEFINES += -DXP_LINUX endif +# Don't use the jemalloc allocator on Android, because we can't guarantee +# that Gecko will configure sqlite before it is first used (bug 730495). +# +# Note: On Windows our sqlite build assumes we use jemalloc. If you disable +# MOZ_STORAGE_MEMORY on Windows, you will also need to change the "ifdef +# MOZ_MEMORY" options in db/sqlite3/src/Makefile.in. +ifdef MOZ_MEMORY +ifneq ($(OS_TARGET), Android) +DEFINES += -DMOZ_STORAGE_MEMORY +endif +endif + EXPORTS_NAMESPACES = mozilla/storage EXPORTS_mozilla/storage = \ diff --git a/storage/src/mozStorageService.cpp b/storage/src/mozStorageService.cpp index 55ef9d996da..54806d0e2b8 100644 --- a/storage/src/mozStorageService.cpp +++ b/storage/src/mozStorageService.cpp @@ -529,7 +529,7 @@ Service::shutdown() sqlite3_vfs *ConstructTelemetryVFS(); -#ifdef MOZ_MEMORY +#ifdef MOZ_STORAGE_MEMORY # include "jemalloc.h" namespace { @@ -599,7 +599,7 @@ const sqlite3_mem_methods memMethods = { } // anonymous namespace -#endif // MOZ_MEMORY +#endif // MOZ_STORAGE_MEMORY nsresult Service::initialize() @@ -608,7 +608,7 @@ Service::initialize() int rc; -#ifdef MOZ_MEMORY +#ifdef MOZ_STORAGE_MEMORY rc = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods); if (rc != SQLITE_OK) return convertResultCode(rc);