% ruby -e 'h = {}
Thread.new { loop { h.delete_if {|k, s| s.length == 0 } } }
loop { h[rand] = "" }
'
-e:3: [BUG] Segmentation fault
ruby 1.8.1 (2003-11-11) [i686-linux]

zsh: abort (core dumped)  ruby -e 

というように core を吐くことがあります。

ただ、(すぐには)吐かないこともありますが、起動しては ^C で止めるという
のを何回かに一回は core を吐きます。

% gdb ruby core
GNU gdb 5.3-debian
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-linux"...
Core was generated by `ruby -e h = {}
Thread.new { loop { h.delete_if {|k, s| s.length == 0 } } }
loop'.
Program terminated with signal 6, Aborted.
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/ld-linux.so.2...done.
Loaded symbols for /lib/ld-linux.so.2
#0  0x400956c1 in kill () from /lib/libc.so.6
(gdb) where
#0  0x400956c1 in kill () from /lib/libc.so.6
#1  0x40095465 in raise () from /lib/libc.so.6
#2  0x400969db in abort () from /lib/libc.so.6
#3  0x080b9ce2 in rb_bug (fmt=0x80d3c60 "Segmentation fault") at error.c:199
#4  0x0809eb1c in sigsegv (sig=11) at signal.c:419
#5  0x400955f8 in __libc_sigaction () from /lib/libc.so.6
#6  0x0806be60 in rb_hash_aset (hash=135360016, key=135359960, val=94187) at hash.c:562
#7  0x080652d3 in call_cfunc (func=0x806bdf0 <rb_hash_aset>, recv=1075552452, len=1075408888, argc=2, argv=0x6)
    at eval.c:4841
#8  0x0805aee5 in rb_call0 (klass=1075587972, recv=1075552452, id=333, oid=0, argc=2, argv=0xbfffc7b0, body=0x401c2968, 
    nosuper=0) at eval.c:4978
#9  0x0805b6cd in rb_call (klass=1075587972, recv=1075552452, mid=333, argc=2, argv=0xbfffc7b0, scope=0) at eval.c:5199
#10 0x080586ac in rb_eval (self=1075616352, n=0x0) at ruby.h:627
#11 0x0805964c in rb_yield_0 (val=6, self=1075616352, klass=0, flags=0, avalue=0) at eval.c:4233
#12 0x08059c1a in rb_f_loop () at eval.c:4334
#13 0x080652d3 in call_cfunc (func=0x8059c00 <rb_f_loop>, recv=1075616352, len=1075408888, argc=0, argv=0x6) at eval.c:4841
#14 0x0805aee5 in rb_call0 (klass=1075621032, recv=1075616352, id=3929, oid=0, argc=0, argv=0x0, body=0x401c91a0, 
    nosuper=0) at eval.c:4978
#15 0x0805b6cd in rb_call (klass=1075621032, recv=1075616352, mid=3929, argc=0, argv=0x0, scope=1) at eval.c:5199
#16 0x08056f99 in rb_eval (self=1075616352, n=0x0) at eval.c:3032
#17 0x080564d2 in rb_eval (self=1075616352, n=0x0) at eval.c:2757
#18 0x080538dc in ruby_exec () at eval.c:1391
#19 0x0805391d in ruby_run () at eval.c:1412
#20 0x08051e11 in main (argc=3, argv=0xbfffdc24, envp=0xbfffdc34) at main.c:50
#21 0x40081e3e in __libc_start_main () from /lib/libc.so.6
(gdb) up
#1  0x40095465 in raise () from /lib/libc.so.6
(gdb) 
#2  0x400969db in abort () from /lib/libc.so.6
(gdb) 
#3  0x080b9ce2 in rb_bug (fmt=0x80d3c60 "Segmentation fault") at error.c:199
199         abort();
(gdb) 
#4  0x0809eb1c in sigsegv (sig=11) at signal.c:419
419         rb_bug("Segmentation fault");
(gdb) 
#5  0x400955f8 in __libc_sigaction () from /lib/libc.so.6
(gdb) 
#6  0x0806be60 in rb_hash_aset (hash=135360016, key=135359960, val=94187) at hash.c:562
562             st_insert(RHASH(hash)->tbl, key, val);
(gdb) p hash
$1 = 135360016
(gdb) p key
$2 = 135359960
(gdb) p val
$3 = 94187
(gdb) p *(struct RHash *)hash
$4 = {basic = {flags = 135099900, klass = 1033}, tbl = 0x0, iter_lev = 135453680, ifnone = 0}
(gdb) 
-- 
[田中 哲][たなか あきら][Tanaka Akira]