From fcd7ee3c886c435f178230b13d0b0cb0c9c40c53 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Wed, 23 May 2018 16:31:42 +0200 Subject: Remove the Dark Matter Detector (DMD) Memeory debugger component. This resolves #376. --- storage/mozStorageService.cpp | 52 ------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'storage/mozStorageService.cpp') diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp index 4f288ad42..8c6f65232 100644 --- a/storage/mozStorageService.cpp +++ b/storage/mozStorageService.cpp @@ -36,9 +36,6 @@ #ifdef MOZ_STORAGE_MEMORY # include "mozmemory.h" -# ifdef MOZ_DMD -# include "DMD.h" -# endif #endif //////////////////////////////////////////////////////////////////////////////// @@ -59,10 +56,6 @@ namespace storage { //////////////////////////////////////////////////////////////////////////////// //// Memory Reporting -#ifdef MOZ_DMD -static mozilla::Atomic gSqliteMemoryUsed; -#endif - static int64_t StorageSQLiteDistinguishedAmount() { @@ -165,13 +158,6 @@ Service::CollectReports(nsIHandleReportCallback *aHandleReport, NS_LITERAL_CSTRING("schema"), schemaDesc, SQLITE_DBSTATUS_SCHEMA_USED, &totalConnSize); } - -#ifdef MOZ_DMD - if (::sqlite3_memory_used() != int64_t(gSqliteMemoryUsed)) { - NS_WARNING("memory consumption reported by SQLite doesn't match " - "our measurements"); - } -#endif } int64_t other = ::sqlite3_memory_used() - totalConnSize; @@ -410,58 +396,20 @@ namespace { // from the standard ones -- they use int instead of size_t. But we don't need // a wrapper for free. -#ifdef MOZ_DMD - -// sqlite does its own memory accounting, and we use its numbers in our memory -// reporters. But we don't want sqlite's heap blocks to show up in DMD's -// output as unreported, so we mark them as reported when they're allocated and -// mark them as unreported when they are freed. -// -// In other words, we are marking all sqlite heap blocks as reported even -// though we're not reporting them ourselves. Instead we're trusting that -// sqlite is fully and correctly accounting for all of its heap blocks via its -// own memory accounting. Well, we don't have to trust it entirely, because -// it's easy to keep track (while doing this DMD-specific marking) of exactly -// how much memory SQLite is using. And we can compare that against what -// SQLite reports it is using. - -MOZ_DEFINE_MALLOC_SIZE_OF_ON_ALLOC(SqliteMallocSizeOfOnAlloc) -MOZ_DEFINE_MALLOC_SIZE_OF_ON_FREE(SqliteMallocSizeOfOnFree) - -#endif - static void *sqliteMemMalloc(int n) { void* p = ::malloc(n); -#ifdef MOZ_DMD - gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p); -#endif return p; } static void sqliteMemFree(void *p) { -#ifdef MOZ_DMD - gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p); -#endif ::free(p); } static void *sqliteMemRealloc(void *p, int n) { -#ifdef MOZ_DMD - gSqliteMemoryUsed -= SqliteMallocSizeOfOnFree(p); - void *pnew = ::realloc(p, n); - if (pnew) { - gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(pnew); - } else { - // realloc failed; undo the SqliteMallocSizeOfOnFree from above - gSqliteMemoryUsed += SqliteMallocSizeOfOnAlloc(p); - } - return pnew; -#else return ::realloc(p, n); -#endif } static int sqliteMemSize(void *p) -- cgit v1.2.3