Bug 1174344 - make error message for mismatched leak log entries more helpful; r=mccr8
authorNathan Froyd <froydnj@mozilla.com>
Mon, 29 Jun 2015 16:36:32 -0400
changeset 250943 46d01eca4537af97a62da4136605875ca92a4b73
parent 250942 105c1cd529a27571ba7b58ee4803d2c413e9e941
child 250944 e9e66c55eaa5faaa70b0da3214658efbac0ebe75
push id61715
push usernfroyd@mozilla.com
push dateWed, 01 Jul 2015 18:58:13 +0000
treeherdermozilla-inbound@46d01eca4537 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1174344
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1174344 - make error message for mismatched leak log entries more helpful; r=mccr8
xpcom/base/nsTraceRefcnt.cpp
--- a/xpcom/base/nsTraceRefcnt.cpp
+++ b/xpcom/base/nsTraceRefcnt.cpp
@@ -419,19 +419,27 @@ GetBloatEntry(const char* aTypeName, uin
 
       entry = new BloatEntry(aTypeName, aInstanceSize);
       PLHashEntry* e = PL_HashTableAdd(gBloatView, aTypeName, entry);
       if (!e) {
         delete entry;
         entry = nullptr;
       }
     } else {
+#ifdef DEBUG
+      static const char kMismatchedSizesMessage[] =
+        "Mismatched sizes were recorded in the memory leak logging table. "
+        "The usual cause of this is having a templated class that uses "
+        "MOZ_COUNT_{C,D}TOR in the constructor or destructor, respectively. "
+        "As a workaround, the MOZ_COUNT_{C,D}TOR calls can be moved to a "
+        "non-templated base class.";
       NS_ASSERTION(aInstanceSize == 0 ||
                    entry->GetClassSize() == aInstanceSize,
-                   "bad size recorded");
+                   kMismatchedSizesMessage);
+#endif
     }
   }
   return entry;
 }
 
 static int
 DumpSerialNumbers(PLHashEntry* aHashEntry, int aIndex, void* aClosure)
 {