Bug 1273875 - On shutdown leak HTTP cache entries memory, r=michal
authorHonza Bambas <honzab.moz@firemni.cz>
Wed, 18 May 2016 06:39:00 +0200
changeset 298912 61d37541894f9d87674a6ba790498db0b9278e38
parent 298911 27e93cb03221d985ee2c389d27be4fa6a5d2307f
child 298913 10a3bd5421b1d223a2e3110396d0ff986197be86
push id77367
push usercbook@mozilla.com
push dateWed, 25 May 2016 11:55:17 +0000
treeherdermozilla-inbound@61d37541894f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmichal
bugs1273875
milestone49.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 1273875 - On shutdown leak HTTP cache entries memory, r=michal
netwerk/cache2/CacheStorageService.cpp
--- a/netwerk/cache2/CacheStorageService.cpp
+++ b/netwerk/cache2/CacheStorageService.cpp
@@ -141,37 +141,43 @@ void CacheStorageService::Shutdown()
   LOG(("CacheStorageService::Shutdown - start"));
 
   mShutdown = true;
 
   nsCOMPtr<nsIRunnable> event =
     NewRunnableMethod(this, &CacheStorageService::ShutdownBackground);
   Dispatch(event);
 
-  mozilla::MutexAutoLock lock(mLock);
-  sGlobalEntryTables->Clear();
-  delete sGlobalEntryTables;
-  sGlobalEntryTables = nullptr;
+  {
+    mozilla::MutexAutoLock lock(mLock);
+#ifdef NS_FREE_PERMANENT_DATA
+    sGlobalEntryTables->Clear();
+    delete sGlobalEntryTables;
+#endif
+    sGlobalEntryTables = nullptr;
+  }
 
   LOG(("CacheStorageService::Shutdown - done"));
 }
 
 void CacheStorageService::ShutdownBackground()
 {
   MOZ_ASSERT(IsOnManagementThread());
 
   // Cancel purge timer to avoid leaking.
   if (mPurgeTimer) {
     mPurgeTimer->Cancel();
   }
 
+#ifdef NS_FREE_PERMANENT_DATA
   Pool(false).mFrecencyArray.Clear();
   Pool(false).mExpirationArray.Clear();
   Pool(true).mFrecencyArray.Clear();
   Pool(true).mExpirationArray.Clear();
+#endif
 }
 
 // Internal management methods
 
 namespace {
 
 // WalkCacheRunnable
 // Base class for particular storage entries visiting