[Ruby 1.9-Bug#4020][Open] Fiber#initialize causes memory leaks

Bug #4020: Fiber#initialize causes memory leaks
http://redmine.ruby-lang.org/issues/show/4020

$B5/I<<T(B: Yusuke E.
$B%9%F!<%?%9(B: Open, $BM%@john(B: Normal
$B%+%F%4%j(B: core
ruby -v: ruby 1.9.3dev (2010-11-03 trunk 29679) [i686-linux]

$B1sF#$G$9!#(B

Fiber#initialize $B$rJ#?t2s8F$V$H%a%b%j%j!<%/$7$^$9!#(B

f = Fiber.new {}
loop { f.send(:initialize) { } } #=> $B%a%b%jL58B>CHq(B

diff --git a/cont.c b/cont.c
index b0b3f41…56ae843 100644
— a/cont.c
+++ b/cont.c
@@ -971,6 +971,10 @@ fiber_t_alloc(VALUE fibval)
rb_fiber_t *fib;
rb_thread_t *th = GET_THREAD();

  • if (DATA_PTR(fibval) != 0) {
  • rb_raise(rb_eRuntimeError, “cannot initialize twice”);
  • }
  • THREAD_MUST_BE_RUNNING(th);
    fib = ALLOC(rb_fiber_t);
    memset(fib, 0, sizeof(rb_fiber_t));


Yusuke E. [email protected]

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

(2010/11/03 16:01), Yusuke E. wrote:

Fiber#initialize $B$rJ#?t2s8F$V$H%a%b%j%j!<%/$7$^$9!#(B

$B!!$4;XE&$"$j$,$H$&$4$6$$$^$9!#%3%_%C%H$b$*4j$$$7$^$9!#(B

$B%A%1%C%H(B #4020 $B$,99?7$5$l$^$7$?!#(B (by Yusuke E.)

$B%9%F!<%?%9(B Open$B$+$i(BClosed$B$KJQ99(B
$B?JD=(B % 0$B$+$i(B100$B$KJQ99(B

This issue was solved with changeset r29682.
Yusuke, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

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