Project

General

Profile

Actions

Bug #20981

closed

rb_undefine_finalizer is missing

Added by KitaitiMakoto (真 北市) 1 day ago. Updated 1 day ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:120404]

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

Also available in: Atom PDF

Like0
Like0Like0Like1Like0