Remove the Dark Matter Detector (DMD) Memeory debugger component.

This resolves #376.
This commit is contained in:
wolfbeast 2018-05-23 16:31:42 +02:00 • committed by Roy Tam
commit 92fbd042f5
55 changed files with 6 additions and 6544 deletions

View file

@ -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<size_t> 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)