Bug 1344848 - Don't check for atom leaks unless we're checking for other leaks. r=erahm
authorAndrew McCreight <continuation@gmail.com>
Mon, 06 Mar 2017 11:50:30 -0800
changeset 346283 f248e1f814d124f48cb7035b017e5c25cc654528
parent 346282 dc335045a33b563f7e4010c9a33d4c9f407d6b0f
child 346284 2c7b8a9a8989e98cb08aa1cf8317c5f2daab2bc5
push id31460
push usercbook@mozilla.com
push dateTue, 07 Mar 2017 14:14:00 +0000
treeherdermozilla-central@47e5c929a487 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1344848
milestone54.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 1344848 - Don't check for atom leaks unless we're checking for other leaks. r=erahm 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