Re: [ruby-changes:32633] nobu:r44712 (trunk): thread_pthread.c: get current main thread stack size

Ruby-dev$B$K2O4_$r$&$D$7$^$7$?!#(B

On Mon, Jan 27, 2014 at 7:53 AM, nobu [email protected] wrote:

  be expanded than allocated size at initialization, by rlimit().

@@ -1,3 +1,15 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1

  •     [ruby-core:60113] [Bug #9454]
    
    if (th) {
    size = th->machine_stack_maxsize;
    +#if defined(HAVE_GETRLIMIT) && MAINSTACKADDR_AVAILABLE
  •   if (pthread_equal(th->thread_id, native_main_thread.id)) {
    
  •       struct rlimit rlim;
    
  •       if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur > size) {
    
  •           size = rlim.rlim_cur;
    
  •       }
    
  •   }
    

+#endif

$B$3$l$,4V0c$C$F$k$3$H$OJ,$+$k$,!"$I$&$7$?$$$N$+$,J,$+$i$J$$!#(B
$B%A%1%C%[email protected]>pJs$,$J$$$N$O$$$D$b$N$3$H$H$O$$$(!&!&!&!&!&(B

$B$^$:!“C1=c$K(Bifdef$B$K(BRLIMIT_STACK$B$NM-L5$,H4$1$F$$$k$H$$$&$N$b$”$k$,!"(B
$B%a%$%s%9%l%C%I$J$i(BRLIM_STACK$B$G<h$l$k$H$$$&$N$,(BLinux$B8GM-$J$N$G!"(B
$B$=$l$O(BHAVE_GETRLIMIT$B$H$+$N5!G=M-L5$8$c$J$/!"(Bifdef linux
$B$G$J$$$H(B
$B$*$+$7$$$h$&$K;W$($k!#(B

[email protected]$H(Brlim_cur$B$,(Bulong$B$G(Binfinity$B$,([email protected]$+$i$D$^$j(BULONG_MAX$B07$$$K$J$C$F(B
$B>o$K%!<%P!<%U%m!<07$$$K$J$i$J$$!#(B
$B$H$$$&$+(B RLIM_INFINITY $B$NCM$O([email protected]$+$iBg>.Hf3S$9$k$^$($K(B
if (rlim.rlim_cur == RLIM_INFINITY) $B$H$+$J$$$H$
$+$7$/$J$$$G$9$+!)(B

$B<!$K!"(Bget_stack()$B$G;H$C$F$$$k(Bpthread_getattr_np()$B$O$b$&$A$g$C$H8-$$$3$H$r$d$C$F$$$F!"(B
/proc/self/maps$B$_$F(BVMA$B$N%5%$%:$rD6$($J$$$h$&[email protected]$7$F$k!#$3$l$rHr$1$?$N$O(B
$B$?$V$s!"%7%0%J%k%3%s%F%-%9%H$H$$$&$N$r0U<[email protected]$H;W$&$7!"[email protected]$7$$$H(B
$B;W$&[email protected]$1$I!"$A$g$C$H%i%U$9$.$k0u>]!#(B

$B$I$&$;(B current
thread$B$H$l$J$$$H$-$O!"([email protected]$+$i!"[email protected]$C$?$i(B
$B%a%$%s%9%l%C%I$N%1!<%9$b(B
get_stack$B8F$s$G$7$^$C$?$[$&$,8mH=Dj8:$k$h$&$K;W$($^$9!#(B

$B%A%1%C%H$K=q$$$F$J$$!"(BOS$B$N%P%0>pJs$J$I$"$j$^$7$?$i65$($F2<$5$$!#(B

[email protected]$G$9!#(B

(2014/01/28 10:06), KOSAKI Motohiro wrote:

$B$^$:!“C1=c$K(Bifdef$B$K(BRLIMIT_STACK$B$NM-L5$,H4$1$F$$$k$H$$$&$N$b$”$k$,!"(B
$B%a%$%s%9%l%C%I$J$i(BRLIM_STACK$B$G<h$l$k$H$$$&$N$,(BLinux$B8GM-$J$N$G!"(B
$B$=$l$O(BHAVE_GETRLIMIT$B$H$+$N5!G=M-L5$8$c$J$/!"(Bifdef linux $B$G$J$$$H(B
$B$*$+$7$$$h$&$K;W$($k!#(B

$B$=$3$O(Blinux$B$G$O$J$/(BMacOS
X$BMQ$G$7$?!#(Blinux$B$G$O2r7h$7$F$$$J$+$C$?$N$G!"(B
r44726$B$G:[email protected]$7$F$_$^$7$?!#(B

[email protected]$H(Brlim_cur$B$,(Bulong$B$G(Binfinity$B$,([email protected]$+$i$D$^$j(BULONG_MAX$B07$$$K$J$C$F(B

$B>o$K%!<%P!<%U%m!<07$$$K$J$i$J$$!#(B
$B$H$$$&$+(B RLIM_INFINITY $B$NCM$O([email protected]$+$iBg>.Hf3S$9$k$^$($K(B
if (rlim.rlim_cur == RLIM_INFINITY) $B$H$+$J$$$H$
$+$7$/$J$$$G$9$+!)(B

$B;n$7$?8B$j$G$O(BOS
X$B$G$O(BRLIM_INFINITY$B$K$O$J$i$J$$$h$&$G$9$,!"8e$G9M$($F$_(B
$B$^$9!#(B

$B<!$K!"(Bget_stack()$B$G;H$C$F$$$k(Bpthread_getattr_np()$B$O$b$&$A$g$C$H8-$$$3$H$r$d$C$F$$$F!"(B

/proc/self/maps$B$_$F(BVMA$B$N%5%$%:$rD6$($J$$$h$&[email protected]$7$F$k!#$3$l$rHr$1$?$N$O(B

$B$?$V$s!"%7%0%J%k%3%s%F%-%9%H$H$$$&$N$r0U<[email protected]$H;W$&$7!"[email protected]$7$$$H(B
$B;W$&[email protected]$1$I!"$A$g$C$H%i%U$9$.$k0u>]!#(B

$B$=$l$O5$$E$$$F$^$;$s$G$7$?!#(Bruby_stack_overflowed_p()$B$G$O(Bget_stack()$B$O(B
$BHr$1$k$Y$-$+$b!D!#(B

$B$I$&$;(B current
thread$B$H$l$J$$$H$-$O!"([email protected]$+$i!"[email protected]$C$?$i(B
$B%a%$%s%9%l%C%I$N%1!<%9$b(B
get_stack$B8F$s$G$7$^$C$?$[$&$,8mH=Dj8:$k$h$&$K;W$($^$9!#(B

$B:#$O$=$s$J46$8$G$9!#(B

$B$=$&$$$($P!"@h$K5s$2$?F|5-$K$b=q$$$F$$$^$9$,!":G6a$N(BOS
X$B$O(Brlimit$BC!$+$J$/$F$b!"(B
pthread_get_stacksize_np(3)
$B$G%9%l%C%I$4$H$N%9%?%C%/%5%$%:$,<h$l$k$h$&$G$9!#(B
$B%=!<%98+$F$b$$$+$K$b$H$l$F$=$&$JJ70O5$!#(B
http://www.opensource.apple.com/source/Libc/Libc-825.40.1/pthreads/pthread.c

2014$BG/(B1$B7n(B28$BF|(B 17:49 NARUSE, Yui [email protected]:

[email protected]$G$9!#(B

(2014/01/28 18:34), NARUSE, Yui wrote:

$B$=$&$$$($P!"@h$K5s$2$?F|5-$K$b=q$$$F$$$^$9$,!":G6a$N(BOS
X$B$O(Brlimit$BC!$+$J$/$F$b!"(B
pthread_get_stacksize_np(3) $B$G%9%l%C%I$4$H$N%9%?%C%/%5%$%:$,<h$l$k$h$&$G$9!#(B
$B%=!<%98+$F$b$$$+$K$b$H$l$F$=$&$JJ70O5$!#(B
http://www.opensource.apple.com/source/Libc/Libc-825.40.1/pthreads/pthread.c

$B$=$l$O$9$G$K;H$C$F$$$k$s$G$9$,!"$J$<$+JV$C$F$/$kCM$,(Bgetrlimit()[email protected]$i$l(B
$B$kCM$N(B16$BJ,$N(B1$B$J$s$G$9$h$M$’!#(B

$B%9%l%C%I$N%9%?%C%/>pJs$N<[email protected]$OA0$K$^$H$a$?$3$H$,$"$j$^$9$,!"(B
http://d.hatena.ne.jp/nurse/20100204
OS$B$4$H$N0MB8$,7c$7$$$N$G!"2<<j$KCj>]2=$;$:(BOS$B$4$H$K$,$C$D$jJ,4t$7$F(B
[email protected]$$$?$[$&$,$$$$$H;W$$$^$9!#(B

$B$"$H!"$I$N(BOS$B$rG0F,[email protected]$K=q$$$F$/[email protected]$5$$!#(B
$B=q$$$F$/$l$J$$$H$^$?2u$9$N$G!#(B

2014$BG/(B1$B7n(B28$BF|(B 16:40 Nobuyoshi N. [email protected]:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs