зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1523874 - Restore the use of sqlite memory hooks. r=mak
Bug 730495 broke them by moving the code to another directory without moving the corresponding #define, but it also fixed why this was disabled in some configurations so we can now just enable when MOZ_MEMORY is defined (jemalloc used). Differential Revision: https://phabricator.services.mozilla.com/D18049 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4c20bd5f4e
Коммит
e47fd6d97d
|
@ -89,23 +89,6 @@ include('/ipc/chromium/chromium-config.mozbuild')
|
||||||
|
|
||||||
FINAL_LIBRARY = 'xul'
|
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()
|
# Thunderbird needs the 2-argument version of fts3_tokenizer()
|
||||||
if CONFIG['MOZ_THUNDERBIRD'] or CONFIG['MOZ_SUITE']:
|
if CONFIG['MOZ_THUNDERBIRD'] or CONFIG['MOZ_SUITE']:
|
||||||
DEFINES['MOZ_SQLITE_FTS3_TOKENIZER'] = 1
|
DEFINES['MOZ_SQLITE_FTS3_TOKENIZER'] = 1
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace storage {
|
||||||
//// Memory Reporting
|
//// Memory Reporting
|
||||||
|
|
||||||
#ifdef MOZ_DMD
|
#ifdef MOZ_DMD
|
||||||
static mozilla::Atomic<size_t> gSqliteMemoryUsed;
|
mozilla::Atomic<size_t> gSqliteMemoryUsed;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int64_t StorageSQLiteDistinguishedAmount() {
|
static int64_t StorageSQLiteDistinguishedAmount() {
|
||||||
|
|
|
@ -7,10 +7,20 @@
|
||||||
#include "AutoSQLiteLifetime.h"
|
#include "AutoSQLiteLifetime.h"
|
||||||
#include "sqlite3.h"
|
#include "sqlite3.h"
|
||||||
|
|
||||||
#ifdef MOZ_STORAGE_MEMORY
|
#ifdef MOZ_MEMORY
|
||||||
# include "mozmemory.h"
|
# include "mozmemory.h"
|
||||||
# ifdef MOZ_DMD
|
# ifdef MOZ_DMD
|
||||||
|
# include "nsIMemoryReporter.h"
|
||||||
# include "DMD.h"
|
# include "DMD.h"
|
||||||
|
|
||||||
|
namespace mozilla {
|
||||||
|
namespace storage {
|
||||||
|
extern mozilla::Atomic<size_t> gSqliteMemoryUsed;
|
||||||
|
}
|
||||||
|
} // namespace mozilla
|
||||||
|
|
||||||
|
using mozilla::storage::gSqliteMemoryUsed;
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -105,7 +115,7 @@ const sqlite3_mem_methods memMethods = {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#endif // MOZ_STORAGE_MEMORY
|
#endif // MOZ_MEMORY
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
|
|
||||||
|
@ -114,7 +124,7 @@ AutoSQLiteLifetime::AutoSQLiteLifetime() {
|
||||||
MOZ_CRASH("multiple instances of AutoSQLiteLifetime constructed!");
|
MOZ_CRASH("multiple instances of AutoSQLiteLifetime constructed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_STORAGE_MEMORY
|
#ifdef MOZ_MEMORY
|
||||||
sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
|
sResult = ::sqlite3_config(SQLITE_CONFIG_MALLOC, &memMethods);
|
||||||
#else
|
#else
|
||||||
sResult = SQLITE_OK;
|
sResult = SQLITE_OK;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче