diff options
author | nagachika <[email protected]> | 2024-07-07 14:47:04 +0900 |
---|---|---|
committer | nagachika <[email protected]> | 2024-07-07 16:44:06 +0900 |
commit | bd5df1693c89d389471d145fc19b487c708912b1 (patch) | |
tree | 02aa26c8eb487a23cf867248464c19c3bbac02a0 /internal/class.h | |
parent | 2a4469ea590e6719eb30e8b7aea7e147e3b82f75 (diff) |
merge revision(s) e626da82eae3d437b84d4f9ead0164d436b08e1a, f3af5ae7e6c1c096bbfe46d69de825a02b1696cf: [Backport #20311]
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.
Make Struct memory leak test faster
[Bug #20311]
It times out on some platform, so we can reduce iterations.
On my machine it completes in 250ms and RSS grows 8X.
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 af83cd8a33..63917e867f 100644 --- a/internal/class.h +++ b/internal/class.h @@ -119,6 +119,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); |