From: Narihiro Nakamura <authornari@...>
Date: 2009-03-23T07:15:37+09:00
Subject: [ruby-dev:38187] Re: [Bug #1310] HEAP_SIZE 	で不具合?

nari です.

うぅ,失礼しました..
ご指摘ありがとうございます.

diff --git a/gc.c b/gc.c
index 835ef5d..829fa7f 100644
--- a/gc.c
+++ b/gc.c
@@ -922,6 +922,9 @@ init_heap(rb_objspace_t *objspace)

     add = HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT;

+    if (!add)
+        add = 1;
+
     if ((heaps_used + add) > heaps_length) {
        allocate_heaps(objspace, heaps_used + add);
     }
@@ -938,6 +941,10 @@ static void
 set_heaps_increment(rb_objspace_t *objspace)
 {
     size_t next_heaps_length = (size_t)(heaps_used * 1.8);
+
+    if (next_heaps_length == heaps_used)
+        next_heaps_length++;
+
     heaps_inc = next_heaps_length - heaps_used;

     if (next_heaps_length > heaps_length) {


2009/03/23 6:52 Nobuyoshi Nakada <nobu@ruby-lang.org>:
> なかだです。
>
> At Sun, 22 Mar 2009 22:48:24 +0900,
> Narihiro Nakamura wrote in [ruby-dev:38185]:
>> @@ -922,6 +922,9 @@ init_heap(rb_objspace_t *objspace)
>>
>>      add = HEAP_MIN_SLOTS / HEAP_OBJ_LIMIT;
>>
>> +    if (add)
>> +        add = 1;
>> +
>
> if (!add) ではなく?
>
> --
> --- 僕の前にBugはない。
> --- 僕の後ろにBugはできる。
>    中田 伸悦
>
>



-- 
Narihiro Nakamura