diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ext/dl/mkcallback.rb | 21 |
2 files changed, 18 insertions, 8 deletions
@@ -1,3 +1,8 @@ +Sat Aug 30 14:39:51 2008 Tanaka Akira <akr@fsij.org> + + * ext/dl/mkcallback.rb (rb_dl_init_callbacks): avoid GC problem which + is caused by 'GC.stress=true; require "dl"'. + Sat Aug 30 10:46:44 2008 Koichi Sasada <ko1@atdot.net> * ext/iconv/iconv.c: remove include pragma for "ruby/intern.h". diff --git a/ext/dl/mkcallback.rb b/ext/dl/mkcallback.rb index 21fb177f8b..4dbd0d6ef6 100644 --- a/ext/dl/mkcallback.rb +++ b/ext/dl/mkcallback.rb @@ -135,16 +135,21 @@ $out << (<<EOS) static void rb_dl_init_callbacks() { + VALUE tmp; cb_call = rb_intern("call"); - rb_DLCdeclCallbackProcs = rb_ary_new(); - rb_DLCdeclCallbackAddrs = rb_ary_new(); - rb_DLStdcallCallbackProcs = rb_ary_new(); - rb_DLStdcallCallbackAddrs = rb_ary_new(); - rb_define_const(rb_mDL, "CdeclCallbackProcs", rb_DLCdeclCallbackProcs); - rb_define_const(rb_mDL, "CdeclCallbackAddrs", rb_DLCdeclCallbackAddrs); - rb_define_const(rb_mDL, "StdcallCallbackProcs", rb_DLStdcallCallbackProcs); - rb_define_const(rb_mDL, "StdcallCallbackAddrs", rb_DLStdcallCallbackAddrs); + tmp = rb_DLCdeclCallbackProcs = rb_ary_new(); + rb_define_const(rb_mDL, "CdeclCallbackProcs", tmp); + + tmp = rb_DLCdeclCallbackAddrs = rb_ary_new(); + rb_define_const(rb_mDL, "CdeclCallbackAddrs", tmp); + + tmp = rb_DLStdcallCallbackProcs = rb_ary_new(); + rb_define_const(rb_mDL, "StdcallCallbackProcs", tmp); + + tmp = rb_DLStdcallCallbackAddrs = rb_ary_new(); + rb_define_const(rb_mDL, "StdcallCallbackAddrs", tmp); + #{ (0...MAX_DLTYPE).collect{|ty| sprintf(" rb_ary_push(rb_DLCdeclCallbackProcs, rb_ary_new3(%d,%s));", |