Bug 946976 - Do not leak the store buffer when re-enabling; r=jonco
☠☠ backed out by 8f91db306f33 ☠ ☠
authorTerrence Cole <terrence@mozilla.com>
Thu, 05 Dec 2013 15:15:05 -0800
changeset 159630 712628797f219e9ecc406a176702b65d4cae4b82
parent 159629 76ddaf7db5bf467c4ae6772342a1315193e7a482
child 159631 cd37573496575d867f6951fba24584da42787081
push id25808
push usercbook@mozilla.com
push dateTue, 10 Dec 2013 12:03:31 +0000
treeherdermozilla-central@7fb91a422c5e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs946976
milestone29.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 946976 - Do not leak the store buffer when re-enabling; r=jonco
js/src/gc/StoreBuffer.h
--- a/js/src/gc/StoreBuffer.h
+++ b/js/src/gc/StoreBuffer.h
@@ -91,17 +91,18 @@ class StoreBuffer
         LifoAlloc *storage_;
 
         explicit MonoTypeBuffer() : storage_(nullptr) {}
         ~MonoTypeBuffer() { js_delete(storage_); }
 
         MonoTypeBuffer &operator=(const MonoTypeBuffer& other) MOZ_DELETE;
 
         bool init() {
-            storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
+            if (!storage_)
+                storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
             return bool(storage_);
         }
 
         void clear() {
             if (!storage_)
                 return;
 
             storage_->used() ? storage_->releaseAll() : storage_->freeAll();
@@ -165,17 +166,18 @@ class StoreBuffer
         LifoAlloc *storage_;
 
         explicit GenericBuffer() : storage_(nullptr) {}
         ~GenericBuffer() { js_delete(storage_); }
 
         GenericBuffer &operator=(const GenericBuffer& other) MOZ_DELETE;
 
         bool init() {
-            storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
+            if (!storage_)
+                storage_ = js_new<LifoAlloc>(LifoAllocBlockSize);
             return bool(storage_);
         }
 
         void clear() {
             if (!storage_)
                 return;
 
             storage_->used() ? storage_->releaseAll() : storage_->freeAll();