Actions
Bug #20981
closedrb_undefine_finalizer is missing
Description
Merry Christmas!
I encountered an error like "dyld[89037]: missing symbol called" in an extension which usesrb_undefine_finalizer
in Ruby 3.4.1. It works fine in Ruby 3.3.6.
The function defined in ruby/include/ruby/internal/gc.h but seems removed from ruby/gc.c. Could you consider restore the implementation or remove the function from gc.h
?
Reproducible code:
extconf.rb¶
require "mkmf"
create_makefile "undefine_finalizer_bug"
undefine_finalizer_bug.c¶
#include<ruby.h>
static VALUE s_undefine_finalizer(VALUE self) {
rb_undefine_finalizer(self);
return Qnil;
}
void Init_undefine_finalizer_bug(void) {
VALUE klass = rb_define_class("UndefineFinalizerBug", rb_cObject);
rb_define_singleton_method(klass, "undefine_finalizer", s_undefine_finalizer, 0);
}
undefine-finalizer-bug.rb¶
require "undefine_finalizer_bug.so"
finalizer = proc {
puts "Finalizer called"
}
ObjectSpace.define_finalizer(UndefineFinalizerBug, finalizer)
UndefineFinalizerBug.new
UndefineFinalizerBug.undefine_finalizer
GC.start
Running¶
Ruby 3.4.1¶
% ruby ./extconf.rb && make && ruby -v -I. ./undefine-finalizer-bug.rb
creating Makefile
linking shared-object undefine_finalizer_bug.bundle
ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [arm64-darwin24]
dyld[2436]: missing symbol called
[1] 2436 abort ruby -v -I. ./undefine-finalizer-bug.rb
Ruby 3.3.6¶
% chruby-exec 3.3.6 -- ruby ./extconf.rb && make && chruby-exec 3.3.6 -- ruby -v -I. ./undefine-finalizer-bug.rb
creating Makefile
linking shared-object undefine_finalizer_bug.bundle
ruby 3.3.6 (2024-11-05 revision 75015d4c1f) [arm64-darwin24]
Thank you.
Actions
Like0
Like0Like0Like1Like0