Reviewed by Geoff.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2006 09:13:03 +0000 (09:13 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Sep 2006 09:13:03 +0000 (09:13 +0000)
        - change garbage collection to happen at increments proportional to number of live objects, not always
        every 1000 allocations

        * kjs/collector.cpp:
        (KJS::Collector::allocate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16614 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/collector.cpp

index 45bca1fd1288705cb91813e8cff5bd78505a81b2..a98685202bcdf6d9ae6412e0a11aa4c45f917862 100644 (file)
@@ -1,3 +1,13 @@
+2006-09-28  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Geoff.
+        
+        - change garbage collection to happen at increments proportional to number of live objects, not always
+        every 1000 allocations
+
+        * kjs/collector.cpp:
+        (KJS::Collector::allocate):
+
 2006-09-28  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Mitz.
index 5ba3b6284d97469f36054594af300783deb01fc8..8deeb15b1072573f01553954d5dff6f69cf06597 100644 (file)
@@ -116,7 +116,9 @@ void* Collector::allocate(size_t s)
 
   // collect if needed
   size_t numLiveObjects = heap.numLiveObjects;
-  if (numLiveObjects - heap.numLiveObjectsAtLastCollect >= ALLOCATIONS_PER_COLLECTION) {
+  size_t numLiveObjectsAtLastCollect = heap.numLiveObjectsAtLastCollect;
+  size_t numNewObjects = numLiveObjects - numLiveObjectsAtLastCollect;
+  if (numNewObjects >= ALLOCATIONS_PER_COLLECTION && numNewObjects >= numLiveObjectsAtLastCollect) {
     collect();
     numLiveObjects = heap.numLiveObjects;
   }