diff options
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | test/ruby/test_module.rb | 15 |
2 files changed, 16 insertions, 1 deletions
@@ -3677,7 +3677,7 @@ obj_free(rb_objspace_t *objspace, VALUE obj) cc_table_free(objspace, obj, FALSE); rb_class_remove_from_module_subclasses(obj); rb_class_remove_from_super_subclasses(obj); -#if !USE_RVARGC +#if !RCLASS_EXT_EMBEDDED xfree(RCLASS_EXT(obj)); #endif diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb index f566eced3a..b915a6ee8f 100644 --- a/test/ruby/test_module.rb +++ b/test/ruby/test_module.rb @@ -3276,6 +3276,21 @@ class TestModule < Test::Unit::TestCase assert_match(/::Foo$/, mod.name, '[Bug #14895]') end + def test_iclass_memory_leak + # [Bug #19550] + assert_no_memory_leak([], <<~PREP, <<~CODE, rss: true) + code = proc do + mod = Module.new + Class.new do + include mod + end + end + 1_000.times(&code) + PREP + 3_000_000.times(&code) + CODE + end + private def assert_top_method_is_private(method) |