ささだです。

 詳しく追っていないのですが、[BUG] が出ました。最初は mswin32 で出会っ
て、ruby 1.9.3dev (2010-07-25 trunk 28751) [x86_64-linux] で再現すること
を確認しました。

$ cat ../trunk/test.rb
class C
  def initialize max
    @max = max
  end

  def size
    rand(@max)
  end
end

ary = []
loop{
  ary << C.new(ary.size)
  ary.sort_by{|e| e.size}
  puts '.'
}

$ make gdb
(中略)
../trunk/test.rb:14: [BUG] rb_gc_mark(): unknown data type
0x10(0x82e160) non object
ruby 1.9.3dev (2010-07-25 trunk 28751) [x86_64-linux]

-- control frame ----------
c:0009 p:---- s:0021 b:0021 l:000016 d:000020 IFUNC
c:0008 p:---- s:0019 b:0019 l:000018 d:000018 CFUNC  :each
c:0007 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC  :sort_by
c:0006 p:0037 s:0014 b:0014 l:001868 d:000013 BLOCK  ../trunk/test.rb:14
c:0005 p:---- s:0012 b:0012 l:000011 d:000011 FINISH
c:0004 p:---- s:0010 b:0010 l:000009 d:000009 CFUNC  :loop
c:0003 p:0026 s:0007 b:0007 l:001868 d:0002b0 EVAL   ../trunk/test.rb:12
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001868 d:001868 TOP
---------------------------
-- Ruby level backtrace information ----------------------------------------
../trunk/test.rb:12:in `<main>'
../trunk/test.rb:12:in `loop'
../trunk/test.rb:14:in `block in <main>'
../trunk/test.rb:14:in `sort_by'
../trunk/test.rb:14:in `each'

-- C level backtrace information -------------------------------------------
/mnt/sdb1/ruby/build/miniruby(rb_vm_bugreport+0xa9) [0x57e9d9]
/mnt/sdb1/ruby/build/miniruby [0x452e76]
/mnt/sdb1/ruby/build/miniruby(rb_bug+0xb1) [0x452ff1]
/mnt/sdb1/ruby/build/miniruby [0x46be06]
/mnt/sdb1/ruby/build/miniruby(rb_thread_mark+0x9e) [0x567c0e]
/mnt/sdb1/ruby/build/miniruby [0x46c5da]
/mnt/sdb1/ruby/build/miniruby [0x567ab9]
/mnt/sdb1/ruby/build/miniruby(st_foreach+0x4c) [0x5133bc]
/mnt/sdb1/ruby/build/miniruby(rb_vm_mark+0x27) [0x567f77]
/mnt/sdb1/ruby/build/miniruby [0x46c5da]
/mnt/sdb1/ruby/build/miniruby [0x46dbb2]
/mnt/sdb1/ruby/build/miniruby [0x46ec00]
/mnt/sdb1/ruby/build/miniruby(rb_node_newnode+0x64) [0x46eff4]
/mnt/sdb1/ruby/build/miniruby [0x44e7e6]
/mnt/sdb1/ruby/build/miniruby [0x56d405]
/mnt/sdb1/ruby/build/miniruby(rb_yield+0x69) [0x579b29]
/mnt/sdb1/ruby/build/miniruby(rb_ary_each+0x45) [0x41f705]
/mnt/sdb1/ruby/build/miniruby [0x56e44b]
/mnt/sdb1/ruby/build/miniruby(rb_iterate+0xd3) [0x569433]
/mnt/sdb1/ruby/build/miniruby(rb_block_call+0x29) [0x5695d9]
/mnt/sdb1/ruby/build/miniruby [0x44d62c]
/mnt/sdb1/ruby/build/miniruby [0x571837]
/mnt/sdb1/ruby/build/miniruby [0x572dd9]
/mnt/sdb1/ruby/build/miniruby [0x578088]
/mnt/sdb1/ruby/build/miniruby [0x57a0d2]
/mnt/sdb1/ruby/build/miniruby(rb_rescue2+0x15b) [0x45764b]
/mnt/sdb1/ruby/build/miniruby [0x569609]
/mnt/sdb1/ruby/build/miniruby [0x571837]
/mnt/sdb1/ruby/build/miniruby [0x572dd9]
/mnt/sdb1/ruby/build/miniruby [0x578088]
/mnt/sdb1/ruby/build/miniruby(rb_iseq_eval_main+0x288) [0x578408]
/mnt/sdb1/ruby/build/miniruby [0x4579c3]
/mnt/sdb1/ruby/build/miniruby(ruby_run_node+0x36) [0x4596e6]
/mnt/sdb1/ruby/build/miniruby(main+0x4d) [0x41a3bd]
/lib/libc.so.6(__libc_start_main+0xe6) [0x2accb98201a6]
/mnt/sdb1/ruby/build/miniruby [0x41a2a9]

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension
libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html


Program received signal SIGABRT, Aborted.
[Switching to Thread 0x2accb9b56290 (LWP 27505)]
0x00002accb9833ed5 in raise () from /lib/libc.so.6
(gdb) bt
#0  0x00002accb9833ed5 in raise () from /lib/libc.so.6
#1  0x00002accb98353f3 in abort () from /lib/libc.so.6
#2  0x0000000000452ff6 in rb_bug (fmt=0x58fbc0 "rb_gc_mark(): unknown
data type 0x%x(%p) %s") at ../trunk/error.c:253
#3  0x000000000046be06 in gc_mark_children (objspace=0x823dd0,
ptr=8577376, lev=1) at ../trunk/gc.c:1820
#4  0x0000000000567c0e in rb_thread_mark (ptr=0x823a50) at
../trunk/vm.c:1650
#5  0x000000000046c5da in gc_mark_children (objspace=0x823dd0,
ptr=8858200, lev=1) at ../trunk/gc.c:1756
#6  0x0000000000567ab9 in vm_mark_each_thread_func (key=27505,
value=27505, dummy=6) at ../trunk/vm.c:1475
#7  0x00000000005133bc in st_foreach (table=0x92ba60, func=0x567ab0
<vm_mark_each_thread_func>, arg=0) at ../trunk/st.c:747
#8  0x0000000000567f77 in rb_vm_mark (ptr=0x823550) at ../trunk/vm.c:1498
#9  0x000000000046c5da in gc_mark_children (objspace=0x823dd0,
ptr=8858240, lev=1) at ../trunk/gc.c:1756
#10 0x000000000046dbb2 in gc_marks (objspace=0x823dd0) at ../trunk/gc.c:1546
#11 0x000000000046ec00 in gc_lazy_sweep (objspace=0x823dd0) at
../trunk/gc.c:2069
#12 0x000000000046eff4 in rb_node_newnode (type=NODE_DOT2, a0=259,
a1=8575640, a2=0) at ../trunk/gc.c:1044
#13 0x000000000044e7e6 in sort_by_i (i=8575640, ary=8593680, argc=<value
optimized out>, argv=<value optimized out>) at ../trunk/enum.c:775
#14 0x000000000056d405 in vm_yield_with_cfunc (th=0x823a50,
block=0x2accb9c56dd0, self=8833160, argc=1, argv=0x8, blockargptr=0x0)
at ../trunk/vm_insnhelper.c:724
#15 0x0000000000579b29 in rb_yield (val=8575640) at ../trunk/vm.c:587
#16 0x000000000041f705 in rb_ary_each (ary=8833160) at ../trunk/array.c:1427
#17 0x000000000056e44b in vm_call0 (th=0x823a50, recv=8833160, id=<value
optimized out>, argc=0, argv=0x8, me=0x8da190) at ../trunk/vm_eval.c:78
#18 0x0000000000569433 in rb_iterate (it_proc=0x56f620 <iterate_method>,
data1=140737488339280, bl_proc=0x44e7a0 <sort_by_i>, data2=<value
optimized out>) at ../trunk/vm_eval.c:852
#19 0x00000000005695d9 in rb_block_call (obj=<value optimized out>,
mid=<value optimized out>, argc=<value optimized out>, argv=<value
optimized out>, bl_proc=0xffffffff, data2=47058777344432) at
../trunk/vm_eval.c:932
#20 0x000000000044d62c in enum_sort_by (obj=8833160) at ../trunk/enum.c:879
#21 0x0000000000571837 in vm_call_method (th=0x823a50,
cfp=0x2accb9c56e00, num=0, blockptr=0x2accb9c56e29, flag=0, id=1480,
me=0x899460, recv=8833160) at ../trunk/vm_insnhelper.c:401
#22 0x0000000000572dd9 in vm_exec_core (th=0x823a50, initial=<value
optimized out>) at ../trunk/insns.def:1006
#23 0x0000000000578088 in vm_exec (th=0x823a50) at ../trunk/vm.c:1145
#24 0x000000000057a0d2 in loop_i () at ../trunk/vm.c:557
#25 0x000000000045764b in rb_rescue2 (b_proc=0x579e50 <loop_i>, data1=0,
r_proc=0, data2=0) at ../trunk/eval.c:646
#26 0x0000000000569609 in rb_f_loop (self=8932400) at ../trunk/vm_eval.c:816
#27 0x0000000000571837 in vm_call_method (th=0x823a50,
cfp=0x2accb9c56f08, num=0, blockptr=0x2accb9c56f31, flag=8, id=2864,
me=0x8ad470, recv=8932400) at ../trunk/vm_insnhelper.c:401
#28 0x0000000000572dd9 in vm_exec_core (th=0x823a50, initial=<value
optimized out>) at ../trunk/insns.def:1006
#29 0x0000000000578088 in vm_exec (th=0x823a50) at ../trunk/vm.c:1145
#30 0x0000000000578408 in rb_iseq_eval_main (iseqval=8835000) at
../trunk/vm.c:1386
#31 0x00000000004579c3 in ruby_exec_internal (n=0x86cfb8) at
../trunk/eval.c:214
#32 0x00000000004596e6 in ruby_run_node (n=<value optimized out>) at
../trunk/eval.c:261
#33 0x000000000041a3bd in main (argc=6, argv=0x7fffffffcfd8) at
../trunk/main.c:35


-- 
// SASADA Koichi at atdot dot net