Bug 1344848 - Don't check for atom leaks unless we're checking for other leaks. r=erahm a=jcristau
authorAndrew McCreight <continuation@gmail.com>
Mon, 06 Mar 2017 11:50:30 -0800
changeset 379031 d5d60e222153ea7a74cc3aa05b543f77cf0a21b8
parent 379030 eb379dba884acac25c3d32d259eef047b5cfd458
child 379032 0aa0fdf91411b86a98cdda2f70065a3af16d000b
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm, jcristau
bugs1344848
milestone53.0
Bug 1344848 - Don't check for atom leaks unless we're checking for other leaks. r=erahm a=jcristau MozReview-Commit-ID: H5x8cLv0YGk
xpcom/ds/nsAtomTable.cpp
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -384,31 +384,36 @@ DynamicAtom::GCAtomTableLocked(const Mut
       continue;
     }
 
     auto atom = static_cast<DynamicAtom*>(entry->mAtom);
     if (atom->mRefCnt == 0) {
       i.Remove();
       delete atom;
       ++removedCount;
-    } else if (aKind == GCKind::Shutdown) {
-      // We only perform these kind of GCs in leak-checking builds.  If
-      // something is anomalous, then we'll report an error here, and crash
-      // later on in this function.
+    }
+#ifdef NS_FREE_PERMANENT_DATA
+    else if (aKind == GCKind::Shutdown && PR_GetEnv("XPCOM_MEM_BLOAT_LOG")) {
+      // Only report leaking atoms in leak-checking builds in a run
+      // where we are checking for leaks, during shutdown. If
+      // something is anomalous, then we'll assert later in this
+      // function.
       nsAutoCString name;
       atom->ToUTF8String(name);
       if (nonZeroRefcountAtomsCount == 0) {
         nonZeroRefcountAtoms = name;
       } else if (nonZeroRefcountAtomsCount < 20) {
         nonZeroRefcountAtoms += NS_LITERAL_CSTRING(",") + name;
       } else if (nonZeroRefcountAtomsCount == 20) {
         nonZeroRefcountAtoms += NS_LITERAL_CSTRING(",...");
       }
       nonZeroRefcountAtomsCount++;
     }
+#endif
+
   }
   if (nonZeroRefcountAtomsCount) {
     nsPrintfCString msg("%d dynamic atom(s) with non-zero refcount: %s",
                         nonZeroRefcountAtomsCount, nonZeroRefcountAtoms.get());
     NS_ASSERTION(nonZeroRefcountAtomsCount == 0, msg.get());
   }
 
   // During the course of this function, the atom table is locked. This means