Hi,
In message "[ruby-talk:8257] Re: Inexplicable core dump [long]"
on 00/12/29, "Nathaniel Talbott" <ntalbott / rolemodelsoft.com> writes:
|Cool! Thanks for the pointer; I'm sure it will be useful in the future as
|well. Here it is:
|
|__BEGIN__
|Program received signal SIGSEGV, Segmentation fault.
|0x47a68d in st_lookup (table=0x40f788,
| key=0x1219 <Address 0x1219 out of bounds>, value=0x2593010) at st.c:253
|253 hash_val = do_hash(key, table);
...
<snip>
Thank you. The backtrace helped me a lot. I found a GC mark leakage.
The smallest error reproducing script was
proc = self.method(:printf).to_proc
GC.start
proc.call("abc\n")
Here's the patch. Hope this helps you.
matz.
--- ChangeLog 2000/12/29 02:47:06 1.289
+++ ChangeLog 2000/12/29 18:17:58
@@ -1 +1,11 @@
+Sat Dec 30 03:14:22 2000 Yukihiro Matsumoto <matz / ruby-lang.org>
+
+ * eval.c (rb_iterate): NODE_CFUNC does not protect its data
+ (nd_tval), so create new node NODE_IFUNC for iteration C
+ function.
+
+ * eval.c (rb_yield_0): use NODE_IFUNC.
+
+ * gc.c (rb_gc_mark): support NODE_IFUNC.
+
Fri Dec 29 11:41:55 2000 Yukihiro Matsumoto <matz / ruby-lang.org>
--- node.h 2000/12/05 09:36:32 1.18
+++ node.h 2000/12/29 18:17:59
@@ -23,2 +23,3 @@
NODE_CFUNC,
+ NODE_IFUNC,
NODE_SCOPE,
@@ -236,2 +237,3 @@
#define NEW_CFUNC(f,c) rb_node_newnode(NODE_CFUNC,f,c,0)
+#define NEW_IFUNC(f,c) rb_node_newnode(NODE_IFUNC,f,c,0)
#define NEW_RFUNC(b1,b2) NEW_SCOPE(block_append(b1,b2))
--- eval.c 2000/12/29 02:46:09 1.140
+++ eval.c 2000/12/29 18:18:11
@@ -3747,3 +3747,3 @@
volatile VALUE retval = Qnil;
- NODE *node = NEW_CFUNC(bl_proc, data2);
+ NODE *node = NEW_IFUNC(bl_proc, data2);
VALUE self = ruby_top_self;
--- gc.c 2000/12/29 02:47:07 1.50
+++ gc.c 2000/12/29 18:18:13
@@ -482,2 +482,3 @@
/* fall through */
+ case NODE_IFUNC:
case NODE_METHOD: /* 2 */