diff --git a/storage/moz.build b/storage/moz.build index 06abd6e2f3db..7c4689e17d95 100644 --- a/storage/moz.build +++ b/storage/moz.build @@ -89,23 +89,6 @@ include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' -# 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). -# -# Don't use the jemalloc allocator when using system sqlite. Linked in libraries -# (such as NSS) might trigger an initialization of sqlite and allocation -# of memory using the default allocator, prior to the storage service -# registering its allocator, causing memory management failures (bug 938730). -# However, this is not an issue if both the jemalloc allocator and the default -# allocator are the same thing. -# -# 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. -if CONFIG['MOZ_MEMORY'] and not CONFIG['MOZ_SYSTEM_SQLITE']: - if CONFIG['OS_TARGET'] != 'Android': - DEFINES['MOZ_STORAGE_MEMORY'] = True - # Thunderbird needs the 2-argument version of fts3_tokenizer() if CONFIG['MOZ_THUNDERBIRD'] or CONFIG['MOZ_SUITE']: DEFINES['MOZ_SQLITE_FTS3_TOKENIZER'] = 1 diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp index d6fa788a7388..e6ce143a1db3 100644 --- a/storage/mozStorageService.cpp +++ b/storage/mozStorageService.cpp @@ -53,7 +53,7 @@ namespace storage { //// Memory Reporting #ifdef MOZ_DMD -static mozilla::Atomic gSqliteMemoryUsed; +mozilla::Atomic gSqliteMemoryUsed; #endif static int64_t StorageSQLiteDistinguishedAmount() { diff --git a/toolkit/xre/AutoSQLiteLifetime.cpp b/toolkit/xre/AutoSQLiteLifetime.cpp index a0d8a3235589..a396f3f30428 100644 --- a/toolkit/xre/AutoSQLiteLifetime.cpp +++ b/toolkit/xre/AutoSQLiteLifetime.cpp @@ -7,10 +7,20 @@ #include "AutoSQLiteLifetime.h" #include "sqlite3.h" -#ifdef MOZ_STORAGE_MEMORY +#ifdef MOZ_MEMORY # include "mozmemory.h" # ifdef MOZ_DMD +# include "nsIMemoryReporter.h" # include "DMD.h" + +namespace mozilla { +namespace storage { +extern mozilla::Atomic gSqliteMemoryUsed; +} +} // namespace mozilla + +using mozilla::storage::gSqliteMemoryUsed; + # endif namespace { @@ -105,7 +115,7 @@ const sqlite3_mem_methods memMethods = { } // namespace -#endif // MOZ_STORAGE_MEMORY +#endif // MOZ_MEMORY namespace mozilla { @@ -114,7 +124,7 @@ AutoSQLiteLifetime::AutoSQLiteLifetime() { MOZ_CRASH("multiple instances of AutoSQLiteLifetime constructed!"); } -#ifdef MOZ_STORAGE_MEMORY +#ifdef MOZ_MEMORY sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods); #else sResult = SQLITE_OK;