Bug 913881, part 5 - Assert for freeing snow white during cycle collector scanning. r=smaug
authorAndrew McCreight <continuation@gmail.com>
Tue, 10 Sep 2013 08:56:36 -0700
changeset 146440 a36c944c929ed44a0ca361743cab150eca1be7c6
parent 146439 d722282fdc4dde056610a04cb4db82c16e018aac
child 146441 fb46afe7f48b31e86a5a78f2c0b7fa6ce25c9f2a
push id25260
push userryanvm@gmail.com
push dateWed, 11 Sep 2013 00:29:30 +0000
treeherdermozilla-central@f73bed2856a8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs913881
milestone26.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 913881, part 5 - Assert for freeing snow white during cycle collector scanning. r=smaug If you call FreeSnowWhite when scanning is true, then objects that get released won't be added to the purple buffer, and you can get leaks.
xpcom/base/nsCycleCollector.cpp
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -2106,16 +2106,17 @@ nsCycleCollector::FreeSnowWhite(bool aUn
 void
 nsCycleCollector::ForgetSkippable(bool aRemoveChildlessNodes,
                                   bool aAsyncSnowWhiteFreeing)
 {
     CheckThreadSafety();
     if (mJSRuntime) {
         mJSRuntime->PrepareForForgetSkippable();
     }
+    MOZ_ASSERT(!mScanInProgress, "Don't forget skippable or free snow-white while scan is in progress.");
     mPurpleBuf.RemoveSkippable(this, aRemoveChildlessNodes,
                                aAsyncSnowWhiteFreeing, mForgetSkippableCB);
 }
 
 MOZ_NEVER_INLINE void
 nsCycleCollector::MarkRoots(GCGraphBuilder &aBuilder)
 {
     mGraph.mRootCount = aBuilder.Count();