summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2025-04-23 11:42:26 +0200
committerJean Boussier <[email protected]>2025-05-09 09:19:25 +0200
commit4de049a3f9709ab8b0b192c40e83b910b80d6de3 (patch)
tree3f88cc1fbc3c6875b62c272b790437eaeeff4f1a /gc.c
parent4ef324c7c1f894d7870f94744e24afdbfd2b27ba (diff)
Deprecate `ObjectSpace._id2ref`
[Feature #15408] Matz decided to deprecate it for Ruby 2.6 or 2.7 but that never actually happened. Given the object_id table is a contention point for Ractors it seems sensible to finally deprecate this API so we can generate and store object ids more efficiently in the future.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/13157
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index 953b2ed70d..0ca08d53e0 100644
--- a/gc.c
+++ b/gc.c
@@ -1965,6 +1965,8 @@ rb_gc_obj_free_vm_weak_references(VALUE obj)
*
* On multi-ractor mode, if the object is not shareable, it raises
* RangeError.
+ *
+ * This method is deprecated and should no longer be used.
*/
static VALUE
@@ -2012,6 +2014,7 @@ id2ref(VALUE objid)
static VALUE
os_id2ref(VALUE os, VALUE objid)
{
+ rb_category_warn(RB_WARN_CATEGORY_DEPRECATED, "ObjectSpace._id2ref is deprecated");
return id2ref(objid);
}