Revision: 10469
Author:   [email protected]
Date:     Fri Jan 20 11:16:00 2012
Log:      Merge r10466 from the bleeding_edge to the 3.7 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/9226020
http://code.google.com/p/v8/source/detail?r=10469

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

=======================================
--- /branches/3.7/src/heap.cc   Tue Dec 13 10:08:45 2011
+++ /branches/3.7/src/heap.cc   Fri Jan 20 11:16:00 2012
@@ -576,7 +576,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);
@@ -615,6 +617,11 @@
       gc_performed = true;
     }
   }
+
+  if (gc_performed) {
+    // Failed to reserve the space after several attempts.
+    V8::FatalProcessOutOfMemory("Heap::ReserveSpace");
+  }
 }


=======================================
--- /branches/3.7/src/version.cc        Wed Jan 11 08:43:07 2012
+++ /branches/3.7/src/version.cc        Fri Jan 20 11:16:00 2012
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     7
 #define BUILD_NUMBER      12
-#define PATCH_LEVEL       17
+#define PATCH_LEVEL       18
 // 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