diff options
author | HParker <HParker@github.com> | 2023-02-17 08:15:03 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2023-03-09 15:34:49 -0800 |
commit | 69465df4242f3b2d8e55fbe18d7c45b47b40a626 (patch) | |
tree | 57aad5e76cfff0615df51443ede9b010d1c4f2f4 /gc.c | |
parent | 65a95b82593683ba2e566fe1d14b086b80874c92 (diff) |
Allow classes and modules to become too complex
This makes the behavior of classes and modules when there are too many instance variables match the behavior of objects with too many instance variables.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7349
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -3558,7 +3558,11 @@ obj_free(rb_objspace_t *objspace, VALUE obj) case T_CLASS: rb_id_table_free(RCLASS_M_TBL(obj)); cc_table_free(objspace, obj, FALSE); - if (RCLASS_IVPTR(obj)) { + if (rb_shape_obj_too_complex(obj)) { + RB_DEBUG_COUNTER_INC(obj_obj_too_complex); + rb_id_table_free(RCLASS_TABLE_IVPTR(obj)); + } + else if (RCLASS_IVPTR(obj)) { xfree(RCLASS_IVPTR(obj)); } if (RCLASS_CONST_TBL(obj)) { |