Reviewers: ulan,

Description:
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
------------------------------------------------------------------------

Please review this at https://chromiumcodereview.appspot.com/9226020/

SVN Base: http://v8.googlecode.com/svn/branches/3.7/

Affected files:
  M     src/heap.cc
  M     src/version.cc


Index: src/heap.cc
===================================================================
--- src/heap.cc (revision 10386)
+++ src/heap.cc (working copy)
@@ -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");
+  }
 }


Index: src/version.cc
===================================================================
--- src/version.cc      (revision 10392)
+++ src/version.cc      (working copy)
@@ -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