From: "peterzhu2118 (Peter Zhu) via ruby-core" Date: 2024-03-06T16:27:42+00:00 Subject: [ruby-core:117065] [Ruby master Feature#20306] Add rb_free_at_exit_p Issue #20306 has been updated by peterzhu2118 (Peter Zhu). > ruby_vm_run_at_exit_hooks is called before rb_objspace_free_objects during shutdown rb_objspace_free_objects should NOT be freeing objects from native extensions, so this is not a problem. Objects from native extensions should have been freed earlier in rb_objspace_call_finalizer. rb_objspace_free_objects is only there to free objects that cannot be freed until the very end (e.g. thread, mutex, main Ractor). ---------------------------------------- Feature #20306: Add rb_free_at_exit_p https://bugs.ruby-lang.org/issues/20306#change-107139 * Author: peterzhu2118 (Peter Zhu) * Status: Open ---------------------------------------- GitHub PR: https://github.com/ruby/ruby/pull/10104 From ticket [#20290](https://bugs.ruby-lang.org/issues/20290#note-6), I found that C extensions could use ruby_vm_at_exit to register hooks to free memory at shutdown. However, they cannot determine whether they should free all memory during shutdown to mirror the behavior of Ruby when RUBY_FREE_AT_EXIT is set. This ticket proposes a new API called rb_free_at_exit_p that returns true when RUBY_FREE_AT_EXIT is set, and false otherwise. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/