Bug 719315: Free unused chunks. (r=luke)
authorChris Leary <cdleary@mozilla.com>
Wed, 18 Jan 2012 18:55:01 -0800
changeset 86079 02e6d576cbd3c28dd2b3955626222b9f3cd45705
parent 86078 78a8aeae5b30f3c7cb7768bfae2645bf75743212
child 86080 5bc8dcf80474165908bd0bd7149565d86e9edeb0
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersluke
bugs719315
milestone12.0a1
Bug 719315: Free unused chunks. (r=luke)
js/src/ds/LifoAlloc.cpp
--- a/js/src/ds/LifoAlloc.cpp
+++ b/js/src/ds/LifoAlloc.cpp
@@ -138,18 +138,22 @@ LifoAlloc::freeUnused()
         if (!lastUsed) {
             freeAll();
             return;
         }
         latest = lastUsed;
     }
 
     /* Free all chunks after |latest|. */
-    for (BumpChunk *victim = latest->next(); victim; victim = victim->next())
+    BumpChunk *it = latest->next();
+    while (it) {
+        BumpChunk *victim = it;
+        it = it->next();
         BumpChunk::delete_(victim);
+    }
 
     latest->setNext(NULL);
 }
 
 LifoAlloc::BumpChunk *
 LifoAlloc::getOrCreateChunk(size_t n)
 {
     if (first) {