diff options
author | Jean Boussier <[email protected]> | 2024-02-29 13:17:22 +0100 |
---|---|---|
committer | Jean Boussier <[email protected]> | 2024-03-01 08:23:38 +0100 |
commit | e626da82eae3d437b84d4f9ead0164d436b08e1a (patch) | |
tree | 058421f46c3fe9eb0b1f1445cb3f4f0c902127f7 /internal/class.h | |
parent | 5d76fe6b2a413c71374c9f799c7a1023e2002457 (diff) |
Don't pin named structs defined in Ruby
[Bug #20311]
`rb_define_class_under` assumes it's called from C and that the
reference might be held in a C global variable, so it adds the
class to the VM root.
In the case of `Struct.new('Name')` it's wasteful and make
the struct immortal.
Diffstat (limited to 'internal/class.h')
-rw-r--r-- | internal/class.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/internal/class.h b/internal/class.h index 74ad956e3e..594f1daea7 100644 --- a/internal/class.h +++ b/internal/class.h @@ -175,6 +175,7 @@ void rb_class_foreach_subclass(VALUE klass, void (*f)(VALUE, VALUE), VALUE); void rb_class_detach_subclasses(VALUE); void rb_class_detach_module_subclasses(VALUE); void rb_class_remove_from_module_subclasses(VALUE); +VALUE rb_define_class_id_under_no_pin(VALUE outer, ID id, VALUE super); VALUE rb_obj_methods(int argc, const VALUE *argv, VALUE obj); VALUE rb_obj_protected_methods(int argc, const VALUE *argv, VALUE obj); VALUE rb_obj_private_methods(int argc, const VALUE *argv, VALUE obj); |