Bug 811018 - Avoid image double-counting false positive from DMD. r=jlebar.

--HG--
extra : rebase_source : 209759e6030ccd119fb036ce10efab7c59c22fab
This commit is contained in:
Nicholas Nethercote 2012-11-15 14:06:34 -08:00
parent cc810d999e
commit 2e9214d6ad

View File

@ -1054,9 +1054,30 @@ DMDVCheckAndDump()
nsCOMPtr<nsIMemoryReporter> r;
e->GetNext(getter_AddRefs(r));
// Just getting the amount is enough for the reporter to report to DMDV.
int64_t amount;
(void)r->GetAmount(&amount);
int32_t kind;
nsresult rv = r->GetKind(&kind);
if (NS_FAILED(rv)) {
continue;
}
nsCString path;
rv = r->GetPath(path);
if (NS_FAILED(rv)) {
continue;
}
// We're only interested in HEAP explicit reporters. (In particular,
// some heap blocks are deliberately measured once inside an "explicit"
// reporter and once outside, which isn't a problem. This condition
// prevents them being reported as double-counted. See bug 811018
// comment 2.)
if (kind == nsIMemoryReporter::KIND_HEAP &&
path.Find("explicit") == 0)
{
// Just getting the amount is enough for the reporter to report to
// DMDV.
int64_t amount;
(void)r->GetAmount(&amount);
}
}
// Do multi-reporters.