bug 1366294 - Part 12 - Clean up after onesself. r=gfritzsche
☠☠ backed out by 6fe44a6c4e46 ☠ ☠
authorChris H-C <chutten@mozilla.com>
Fri, 14 Jul 2017 15:02:54 -0400
changeset 418463 b722d638f6ed9d6a04ed4fa8285029c781c843b7
parent 418462 aee317b1445d926a176b31c14ae1e627fc0b57fd
child 418464 f2d79c13799ab0ca6eeb044aabdf873ac225efd2
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1366294
milestone56.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 1366294 - Part 12 - Clean up after onesself. r=gfritzsche Without the StatisticsRecorder cleaning up after us we need to now manually delete the Histograms we create. MozReview-Commit-ID: 8jrPPBQmU0Z
toolkit/components/telemetry/TelemetryHistogram.cpp
--- a/toolkit/components/telemetry/TelemetryHistogram.cpp
+++ b/toolkit/components/telemetry/TelemetryHistogram.cpp
@@ -1625,16 +1625,34 @@ void TelemetryHistogram::InitializeGloba
 
 void TelemetryHistogram::DeInitializeGlobalState()
 {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   gCanRecordBase = false;
   gCanRecordExtended = false;
   gNameToHistogramIDMap.Clear();
   gInitDone = false;
+
+  // FactoryGet `new`s Histograms for us, but requires us to manually delete.
+  for (size_t i = 0; i < HistogramCount; ++i) {
+    for (uint32_t process = 0; process < static_cast<uint32_t>(ProcessID::Count); ++process) {
+      delete gKeyedHistogramStorage[i][process];
+      gKeyedHistogramStorage[i][process] = nullptr;
+      for (uint32_t session = 0; session <
+        static_cast<uint32_t>(SessionType::Count); ++session) {
+        if (gHistogramStorage[i][process][session] == gExpiredHistogram) {
+          continue;
+        }
+        delete gHistogramStorage[i][process][session];
+        gHistogramStorage[i][process][session] = nullptr;
+      }
+    }
+  }
+  delete gExpiredHistogram;
+  gExpiredHistogram = nullptr;
 }
 
 #ifdef DEBUG
 bool TelemetryHistogram::GlobalStateHasBeenInitialized() {
   StaticMutexAutoLock locker(gTelemetryHistogramMutex);
   return gInitDone;
 }
 #endif