From: nobu.nakada@... Date: 2003-12-05T15:21:12+09:00 Subject: [ruby-dev:22150] Re: core dump with ObjectSpace.each_object. なかだです。 At Fri, 5 Dec 2003 14:37:03 +0900, Yukihiro Matsumoto wrote: > |次のように core を吐くことがあります。 > | > |% cat x.rb > |at_exit { > | ObjectSpace.each_object(Object) {|o| } > |} > > at_exitの実行中にGCが発生するとSEGVしてました。修正します。 at_exitの実行中、tmp_end_procsはfreeされた領域を指してしまうん じゃないでしょうか。 ちなみに私が考えてたのはこんなの。 Index: eval.c =================================================================== RCS file: /cvs/ruby/src/ruby/eval.c,v retrieving revision 1.599 diff -u -2 -p -r1.599 eval.c --- eval.c 4 Dec 2003 21:57:35 -0000 1.599 +++ eval.c 5 Dec 2003 05:24:32 -0000 @@ -6609,5 +6609,4 @@ rb_exec_end_proc() while (ephemeral_end_procs) { link = ephemeral_end_procs; - ephemeral_end_procs = 0; while (link) { PUSH_TAG(PROT_NONE); @@ -6621,5 +6620,5 @@ rb_exec_end_proc() } tmp = link; - link = link->next; + ephemeral_end_procs = link = link->next; free(tmp); } @@ -6627,5 +6626,4 @@ rb_exec_end_proc() while (end_procs) { link = end_procs; - end_procs = 0; while (link) { PUSH_TAG(PROT_NONE); @@ -6639,5 +6637,5 @@ rb_exec_end_proc() } tmp = link; - link = link->next; + end_procs = link = link->next; free(tmp); } -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦