福間@福岡 です。

class/module blockの中で新しいスレッドを起こしたあと、GCが発生すると
落ちるようです。

  % cat bug.rb
  module Foo
    Thread.new {}
  end
  GC.start

  % ruby -v bug.rb
  ruby 1.4.0 (1999-08-13) [i386-freebsd4.0]
  bug.rb:4: [BUG] Segmentation fault
  zsh: abort (core dumped)  ruby -v bug.rb

一応スタックトレースを付けます:

| (gdb) bt
| #0  rb_gc_mark_frame (frame=0x98ae0580) at ../src/gc.c:850
| #1  0x805ab83 in thread_mark (th=0x80c2100) at ../src/eval.c:6061
| #2  0x805f7a8 in rb_gc_mark (ptr=0x80ef420) at ../src/gc.c:588
| #3  0x805abdd in rb_gc_mark_threads () at ../src/eval.c:6082
| #4  0x805fd2f in rb_gc () at ../src/gc.c:937
| #5  0x805fd80 in gc_start () at ../src/gc.c:957
| #6  0x8056767 in call_cfunc (func=0x805fd78 <gc_start>, recv=135167868, len=0, 
|     argc=0, argv=0x0) at ../src/eval.c:3677
| #7  0x8056c12 in rb_call0 (klass=135167848, recv=135167868, id=5113, argc=0, 
|     argv=0x0, body=0x80e7f54, nosuper=1) at ../src/eval.c:3813
| #8  0x805724f in rb_call (klass=135167848, recv=135167868, mid=5113, argc=0, 
|     argv=0x0, scope=0) at ../src/eval.c:4007
| #9  0x805323c in rb_eval (self=135212748, node=0x80e7900) at ../src/eval.c:2183
| #10 0x805095c in eval_node (self=135212748) at ../src/eval.c:987
| #11 0x8050a45 in ruby_run () at ../src/eval.c:1023
| #12 0x804f860 in main (argc=2, argv=0xbfbfd7bc, envp=0xbfbfd7c8)
|     at ../src/main.c:39
| #13 0x804f7e1 in _start ()

---
 Yasuhiro Fukuma (福間 康弘) as Yasu.F @ Kitakyushu.Fukuoka.Japan
 Web site: http://www8.big.or.jp/~yasuf/
 PGP fingerprint = 17 25 8A F3 99 E5 7E 19  C0 EA 6E 03 8A C3 CE F0
 “今月の目標: 「盗聴に注意しましょう」”