Revision: 10467
Author:   [email protected]
Date:     Fri Jan 20 09:39:15 2012
Log:      Merge r10466 from the bleeding_edge to the 3.6 branch.

Limit number of loop iterations in Heap::ReserveSpace.

This allows to avoid infinite loops in pathalogical cases e.g. when OS refuses to give new pages to V8.

[email protected]
BUG=99027

Review URL: https://chromiumcodereview.appspot.com/8286020
------------------------------------------------------------------------
Review URL: https://chromiumcodereview.appspot.com/9138028
http://code.google.com/p/v8/source/detail?r=10467

Modified:
 /branches/3.6/src/heap.cc
 /branches/3.6/src/version.cc

=======================================
--- /branches/3.6/src/heap.cc   Thu Jan 19 07:25:55 2012
+++ /branches/3.6/src/heap.cc   Fri Jan 20 09:39:15 2012
@@ -563,7 +563,9 @@
   PagedSpace* cell_space = Heap::cell_space();
   LargeObjectSpace* lo_space = Heap::lo_space();
   bool gc_performed = true;
-  while (gc_performed) {
+  int counter = 0;
+  static const int kThreshold = 20;
+  while (gc_performed && counter++ < kThreshold) {
     gc_performed = false;
     if (!new_space->ReserveSpace(new_space_size)) {
       Heap::CollectGarbage(NEW_SPACE);
@@ -602,6 +604,11 @@
       gc_performed = true;
     }
   }
+
+  if (gc_performed) {
+    // Failed to reserve the space after several attempts.
+    V8::FatalProcessOutOfMemory("Heap::ReserveSpace");
+  }
 }


=======================================
--- /branches/3.6/src/version.cc        Thu Jan 19 07:25:55 2012
+++ /branches/3.6/src/version.cc        Fri Jan 20 09:39:15 2012
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     6
 #define BUILD_NUMBER      6
-#define PATCH_LEVEL       19
+#define PATCH_LEVEL       20
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to