Did you really commit this 3 months after the code review was created?
 The code looks rather different now.

On Fri, Jan 20, 2012 at 6:22 PM,  <[email protected]> wrote:
> Revision: 10466
> Author:   [email protected]
> Date:     Fri Jan 20 09:21:26 2012
> Log:      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
> http://code.google.com/p/v8/source/detail?r=10466
>
> Modified:
>  /branches/bleeding_edge/src/heap.cc
>
> =======================================
> --- /branches/bleeding_edge/src/heap.cc Fri Jan 20 05:43:21 2012
> +++ /branches/bleeding_edge/src/heap.cc Fri Jan 20 09:21:26 2012
> @@ -583,7 +583,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);
> @@ -622,6 +624,11 @@
>       gc_performed = true;
>     }
>   }
> +
> +  if (gc_performed) {
> +    // Failed to reserve the space after several attempts.
> +    V8::FatalProcessOutOfMemory("Heap::ReserveSpace");
> +  }
>  }
>
>
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev



-- 
Erik Corry, Software Engineer
Google Denmark ApS - Frederiksborggade 20B, 1 sal,
1360 København K - Denmark - CVR nr. 28 86 69 84

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

Reply via email to