Bug 1340425 - Add back the magic GC in DoShutdown() to avoid intermittent leaks. r=smaug, a=lizzard
authorAndrew McCreight <continuation@gmail.com>
Wed, 23 Aug 2017 10:27:12 -0700
changeset 423833 cb236dfdd7bbffb31d9fc33e22d9645f768f9a42
parent 423832 fe5af9d9fdb24c25b59f796b13c1070c9f41cfd1
child 423834 2c15a6ed11f7912081bd7e029fab8ddfb2b41145
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, lizzard
bugs1340425
milestone56.0
Bug 1340425 - Add back the magic GC in DoShutdown() to avoid intermittent leaks. r=smaug, a=lizzard MozReview-Commit-ID: CNkjPk9FLKj
toolkit/xre/nsXREDirProvider.cpp
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1132,16 +1132,24 @@ nsXREDirProvider::DoShutdown()
   if (mProfileNotified) {
     nsCOMPtr<nsIObserverService> obsSvc =
       mozilla::services::GetObserverService();
     NS_ASSERTION(obsSvc, "No observer service?");
     if (obsSvc) {
       static const char16_t kShutdownPersist[] = u"shutdown-persist";
       obsSvc->NotifyObservers(nullptr, "profile-change-net-teardown", kShutdownPersist);
       obsSvc->NotifyObservers(nullptr, "profile-change-teardown", kShutdownPersist);
+
+#ifdef DEBUG
+      // Not having this causes large intermittent leaks. See bug 1340425.
+      if (JSContext* cx = dom::danger::GetJSContext()) {
+        JS_GC(cx);
+      }
+#endif
+
       obsSvc->NotifyObservers(nullptr, "profile-before-change", kShutdownPersist);
       obsSvc->NotifyObservers(nullptr, "profile-before-change-qm", kShutdownPersist);
       obsSvc->NotifyObservers(nullptr, "profile-before-change-telemetry", kShutdownPersist);
     }
     mProfileNotified = false;
   }
 
 #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)