# \[Bug #1310\] HEAP\_SIZE $B$GIT6q9g!)(B

**URL:** <https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583>\
**Category:** Development\
**Created:** [March 22, 2009, 2:53pm UTC](https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583 "2009-03-22T14:53:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Narihiro\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Narihiro\_N](https://www.ruby-forum.com/u/Narihiro_N)\
**Post date:** [March 22, 2009, 2:53pm UTC](https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583/1 "2009-03-22T14:53:13Z")

</div>

e$B%A%1%C%He(B #1310 e$B$,99?7$5$l$^$7$?!#e(B (by Narihiro N.)

narie$B$G$9!%e(B

e$B$I$&$d$ie(B HEAP\_SIZE e$B$,Bg$-$9$.$k$H!$DI2C$9$ke(B heap\_slot  
e$B?t$N7W;;$,$\*$+$7$/$J$k$h$&$G$9!%e(B

e$B0J2\<$NMM$K=$@5$9$k$HD\>$j$^$7$?!%e(B

e$B59$7$1$l$P%3%\_%C%H$7$?$$$N$G$9$,$$$+$,$G$7$g$&$+!%e(B

diff --git a/gc.c b/gc.c  
index 835ef5d…8280ec1 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;

* * *

Narihiro Nakmaura

* * *

[http://redmine.ruby-lang.org/issues/show/1310](http://redmine.ruby-lang.org/issues/show/1310)

---

<div class="post-metadata">

**Author:** ![Narihiro\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Narihiro\_N](https://www.ruby-forum.com/u/Narihiro_N)\
**Post date:** [March 22, 2009, 10:56pm UTC](https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583/2 "2009-03-22T22:56:57Z")

</div>

e$B$J$+$@$G$9!#e(B

At Sun, 22 Mar 2009 22:48:24 +0900,  
Narihiro N. 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) e$B$G$O$J$/e(B?

---

<div class="post-metadata">

**Author:** ![Narihiro\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Narihiro\_N](https://www.ruby-forum.com/u/Narihiro_N)\
**Post date:** [March 22, 2009, 11:19pm UTC](https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583/3 "2009-03-22T23:19:11Z")

</div>

nari e$B$G$9!%e(B

e$B$&$%!$\<:Ni$7$^$7$?!%!%e(B  
e$B$4;XE&$"$j$,$H$&$4$6$$$^$9!%e(B

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;

2009/03/23 6:52 Nobuyoshi N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Narihiro\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/9fc29f/32.png) [@Narihiro\_N](https://www.ruby-forum.com/u/Narihiro_N)\
**Post date:** [March 23, 2009, 4:57am UTC](https://www.ruby-forum.com/t/bug-1310-heap-size-b-git6q9g-b/163583/4 "2009-03-23T04:57:46Z")

</div>

e$B$^$D$b$He(B e$B$f$-$R$m$G$9e(B

In message “Re: [ruby-dev:38187] Re: [Bug #1310] HEAP\_SIZE  
e$B$GIT6q9g!)e(B”  
on Mon, 23 Mar 2009 07:15:37 +0900, Narihiro N.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

|e$B$4;XE&$"$j$,$H$&$4$6$$$^$9!%e(B  
|  
|diff --git a/gc.c b/gc.c  
|index 835ef5d…829fa7f 100644

e$B$A$c$s$HF0$+$7$FLdBj$,=P$J$$$h$&$J$i%3%\_%C%H$7$F$/$@$5$$!#e(B
