# GC problem (?) in 1.8

**URL:** <https://www.ruby-forum.com/t/gc-problem-in-1-8/63967>\
**Category:** Development\
**Created:** [June 20, 2006, 9:53pm UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967 "2006-06-20T21:53:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 20, 2006, 9:53pm UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/1 "2006-06-20T21:53:38Z")

</div>

å?é?¨ã§ã?ã??

æ?°æ?¥å?ã?ã??å?é?¨ã®autobuildã§1.8ã?ã?¿ã?¤ã? ã?¢ã?¦ã??ã?ã¦ã?ã??ã®ã«ã?æ°?ä»?ãã®æ?¹ã??ã?  
ã??ã??ã??ã¨æ?ã?ã¾ã?ã??  
ç¾è±¡ã¨ã?ã¦ã¯å®?å?¨ã«ç?¡åå¿?ã«ãªã??ç?¶æ³ãªã?ã?ã?gdbã§æ¨ªã?ã??attachã?ã¦ã¿ã?ã¨ã?  
ã?ã?ã©ã?ã??ã??GCã«çªå?¥ã?ã?ã¾ã¾å¸°ã£ã¦ã?ãªããªã£ã¦ã?ã??ã??ã?ã«è¦?ã?ã¾ã?ã??

ã¨ã??ã?ã?ã?ç§ã§ã¯ã?ã®ãã??ã?ã¾ã§ã?ã?è¿½ã?ãã??ã¦ãªã?ã®ã§ã?ã?ã?ä»?ã«ã©ã®ã??ã?ãª  
æ??å ±ã?å¿?è¦ãã?ã§ã?ã??ã?ã??

---

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 21, 2006, 9:17am UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/2 "2006-06-21T09:17:34Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
URABE Shyouhei [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> e$B?tF|A0$+$iKNIt$Ne(Bautobuilde$B$Ge(B1.8e$B$,%?%$%`%“%&%H$7$F$$$k$N$K$\*5$IU$-$NJ}$b$\*e(B  
> e$B$i$l$k$H;W$$$^$9!#e(B  
> e$B8=\>]$H$7$F$O40A4$KL5H?1~$K$J$k\>u67$J$?$a!“e(Bgdbe$B$G2#$+$ie(Battache$B$7$F$\_$?$H$3e(B  
> e$B$m!”$I$&$d$ie(BGCe$B$KFMF~$7$?$^$^5”$C$F$3$J$/$J$C$F$$$k$h$&$K8+$($^$9!#e(B
> 
> e$B$H$j$"$($:;d$G$O$3$N$/$i$$$^$G$7$+DI$$$-$l$F$J$$$N$G$9$,!"B\>$K$I$N$h$&$Je(B  
> e$B\>pJs$,I,MW$=$&$G$7$g$&$+e(B?

[http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/summary.html](http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/summary.html)  
[http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/log/20060616T003305.txt.gz](http://www.rubyist.net/~kazu/chkbuild/powerpc-darwin/ruby-1.8-pth/log/20060616T003305.txt.gz)  
e$B$@$H!"e(Btest\_process.rb e$B$,2x$7$$$N$G\<j$rF~$l$F$\_$^$7$?$,$I$&$Ge(B  
e$B$7$g$&$+!#e(B

---

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 21, 2006, 4:01pm UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/3 "2006-06-21T16:01:43Z")

</div>

e$BKNIt$G$9!#e(B

Tanaka A. wrote:

> test\_process.rb e$B$,2x$7$$$N$G\<j$rF~$l$F$\_$^$7$?$,$I$&$G$7$g$&$+!#e(B

0F0Ee$B$K$J$j$^$7$?!#e(B

e$B$b$&$A$g$C$HFM$C9~$s$GD4$Y$F$\_$k$H!"e(B

% ruby-1.8 -ve’  
f = Process::RLIMIT\_NOFILE  
a = Process.getrlimit f  
p a  
Process.setrlimit f, 0, a[1]  
b = Process.getrlimit f  
p b  
Process.setrlimit f, a[0], a[1]’  
ruby 1.8.5 (2006-06-21) [powerpc-darwin8.6.0]  
[256, 9223372036854775807]  
[0, 10240]  
-e:8:in `setrlimit’: Operation not permitted - setrlimit (Errno::EPERM)  
from -e:9  
zsh: exit 1 ruby-1.8

e$B$H$+$$$C$?\>u67$,H/@8$7$F$$$k$h$&$G$9!#e(Brlim\_maxe$B$,Bg$-$9$.$Ge(BEPERMe$B$K$J$C$Fe(B  
e$B$$$k$N$O$"$k0UL#@5\>o$G$9$,!"e(B

- e$B:G=i$K\<h$l$F$kCM$,$\*$+$7$$e(B
- 

e$B$?$H$(e(BRLIMIT\_NOFILEe$B$,e(B0e$B$N$^$^$@$H$7$F$be(BGCe$B$,;\_$^$i$J$/$J$k$N$O$I$&$J$N$+e(B  
e$B$3$N$"$?$j$KLdBj$,$"$k$h$&$J5$$,$7$^$9!#e(B

---

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 21, 2006, 9:01pm UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/4 "2006-06-21T21:01:54Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
URABE Shyouhei [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> e$B$H$+$$$C$?\>u67$,H/@8$7$F$$$k$h$&$G$9!#e(Brlim\_maxe$B$,Bg$-$9$.$Ge(BEPERMe$B$K$J$C$Fe(B  
> e$B$$$k$N$O$"$k0UL#@5\>o$G$9$,!"e(B
> 
> - e$B:G=i$K\<h$l$F$kCM$,$\*$+$7$$e(B

e$B$3$C$A$O$h$/$o$+$j$^$;$s!#e(B

> - e$B$?$H$(e(BRLIMIT\_NOFILEe$B$,e(B0e$B$N$^$^$@$H$7$F$be(BGCe$B$,;\_$^$i$J$/$J$k$N$O$I$&$J$N$+e(B  
> e$B$3$N$“$?$j$KLdBj$,$”$k$h$&$J5$$,$7$^$9!#e(B

e$B$3$l$Oe(B sock\_s\_socketpair e$B$,!“e(BGC e$B$rB3$1$F$$$1$P$-$C$He(B  
descriptor e$B$,6u$/!”$H?.$8$F$$$k$+$i$G$9$M!#e(B

1e$B2s$G$"$-$i$a$k$J$i$3$&$G$7$g$&$+!#e(B

# Index: ext/socket/socket.c

RCS file: /src/ruby/ext/socket/socket.c,v  
retrieving revision 1.108.2.51  
diff -u -p -r1.108.2.51 socket.c  
— ext/socket/socket.c 17 Jun 2006 15:53:27 -0000 1.108.2.51  
+++ ext/socket/socket.c 21 Jun 2006 18:58:06 -0000  
@@ -2304,15 +2304,17 @@ sock\_s\_socketpair(klass, domain, type, p  
VALUE klass, domain, type, protocol;  
{  
#if defined HAVE\_SOCKETPAIR

- int d, t, sp[2];

- int d, t, p, sp[2];

- int ret;

- again:
- if (socketpair(d, t, NUM2INT(protocol), sp) \< 0) {
- if (errno == EMFILE || errno == ENFILE) {
- 

```
  rb_gc();

```

- 

```
  goto again;

```

- }

- p = NUM2INT(protocol);
- ret = socketpair(d, t, p, sp);
- if (ret \< 0 && (errno == EMFILE || errno == ENFILE)) {
- 

```
   rb_gc();

```

- 

```
   ret = socketpair(d, t, p, sp);

```

- }
- if (ret \< 0) {  
rb\_sys\_fail(“socketpair(2)”);  
}

---

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 22, 2006, 12:22am UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/5 "2006-06-22T00:22:04Z")

</div>

e$BKNIt$G$9!#e(B

Tanaka A. wrote:

> > - e$B:G=i$K\<h$l$F$kCM$,$\*$+$7$$e(B
> 
> e$B$3$C$A$O$h$/$o$+$j$^$;$s!#e(B

e$B$I$&$d$i$\*$+$7$$$H;W$C$?$3$NCM$Oe(BRLIM\_INFINITYe$B$N$h$&$G$9!#$H$$$&$o$1$G!“e(B  
e$BLdBjE@$O!Ve(Bsetrlimit(2)e$B$Ke(B  
RLIMIT\_INFINITYe$B$rEO$9$H!”$J$s$+$X$s$JJQ49$,$+e(B  
e$B$+$C$F$7$^$&$h$&$K8+$($k!W$H$$$&E@$G$9$M!#$Y$D$Ke(BRubye$B8GM-$NLdBj$H$$$&$o$1e(B  
e$B$G$b$J$5$=$&$G$9!#0J2\<$N$h$&$Ke(Bpythone$B$K$bF1MM$NLdBj$,$"$k$3$H$,4QB,$G$-$^$9!#e(B

% python  
Python 2.3.5 (#1, Aug 22 2005, 22:13:23)  
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin  
Type “help”, “copyright”, “credits” or “license” for more information.

> > > import resource  
> > > f = resource.RLIMIT\_NOFILE  
> > > a = resource.getrlimit(f)  
> > > print a  
> > > (256L, 9223372036854775807L)
> 
> > > resource.setrlimit(f, (0, a[1]))  
> > > b = resource.getrlimit(f)  
> > > print b  
> > > (0L, 10240L)
> 
> > > resource.setrlimit(f, a)  
> > > Traceback (most recent call last):  
> > > File “”, line 1, in ?  
> > > ValueError: not allowed to raise maximum limit
> 
> > > ^D  
> > > %

---

<div class="post-metadata">

**Author:** ![URABE\_Shyouhei](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/eb8c5e/32.png) [@URABE\_Shyouhei](https://www.ruby-forum.com/u/URABE_Shyouhei)\
**Post date:** [June 23, 2006, 4:15pm UTC](https://www.ruby-forum.com/t/gc-problem-in-1-8/63967/6 "2006-06-23T16:15:30Z")

</div>

In article [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid),  
URABE Shyouhei [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> e$B$I$&$d$i$\*$+$7$$$H;W$C$?$3$NCM$Oe(BRLIM\_INFINITYe$B$N$h$&$G$9!#$H$$$&$o$1$G!“e(B  
> e$BLdBjE@$O!Ve(Bsetrlimit(2)e$B$Ke(B RLIMIT\_INFINITYe$B$rEO$9$H!”$J$s$+$X$s$JJQ49$,$+e(B  
> e$B$+$C$F$7$^$&$h$&$K8+$($k!W$H$$$&E@$G$9$M!#$Y$D$Ke(BRubye$B8GM-$NLdBj$H$$$&$o$1e(B  
> e$B$G$b$J$5$=$&$G$9!#0J2\<$N$h$&$Ke(Bpythone$B$K$bF1MM$NLdBj$,$"$k$3$H$,4QB,$G$-$^$9!#e(B

e$B$D$$e(B OpenDarwin e$B$N%=!\<%9$rD/$a$F$7$^$C$?$H$3$m!"e(B

src/xnu/bsd/kern/kern\_resource.c e$B$Ke(B

```
    case RLIMIT_NOFILE:
            /*
            * Only root can set the maxfiles limits, as it is 

```

systemwide resource  
\*/  
if ( is\_suser() ) {  
if (limp-\>rlim\_cur \> maxfiles)  
limp-\>rlim\_cur = maxfiles;  
if (limp-\>rlim\_max \> maxfiles)  
limp-\>rlim\_max = maxfiles;  
}  
else {  
if (limp-\>rlim\_cur \> maxfilesperproc)  
limp-\>rlim\_cur = maxfilesperproc;  
if (limp-\>rlim\_max \> maxfilesperproc)  
limp-\>rlim\_max = maxfilesperproc;  
}  
break;

e$B$H$$$&$h$&$J%3!\<%I$,$"$j!"e(Bmaxfilesperproc e$B$G8!:w$9$k$He(B  
[http://lists.apple.com/archives/macos-x-server/2004/May/msg01103.html](http://lists.apple.com/archives/macos-x-server/2004/May/msg01103.html)  
[http://discus-hamburg.cocolog-nifty.com/mac\_de\_oracle/2005/05/panther\_de\_orac\_dc5e.html](http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2005/05/panther_de_orac_dc5e.html)  
e$B$H$+$Ne(B sysctl -a e$B$N7k2LCf$Ke(B  
kern.maxfilesperproc = 10240  
e$B$H$$$&$N$,8+$i$l$^$9!#e(B

> > > > f = resource.RLIMIT\_NOFILE  
> > > > a = resource.getrlimit(f)  
> > > > print a  
> > > > (256L, 9223372036854775807L)  
> > > > resource.setrlimit(f, (0, a[1]))  
> > > > b = resource.getrlimit(f)  
> > > > print b  
> > > > (0L, 10240L)

e$B$3$3$Ne(B 10240 e$B$H4X78$"$C$?$j$7$J$$$G$7$g$&$+!#e(B
