summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorMatt Valentine-House <matt@eightbitraptor.com>2021-11-10 22:42:40 +0000
committerPeter Zhu <peter@peterzhu.ca>2021-11-11 08:54:48 -0500
commitc53aecee3bec524b91d7f2534291802a1cabb3f5 (patch)
treeb905e87ada1b2d1748cc2839b69b26fb7a181e7a /test/ruby
parentb5531adf4160304ca62b7d128af458704c9beb4e (diff)
fix a memory leak introduced in 8bbd319
This commit fixes a memory leak introduced in an early part of the variable width allocation project that would prevent the rb_classext_t struct from being free'd when the class is swept.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5103
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_class.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_class.rb b/test/ruby/test_class.rb
index 4ae230f91e..eb448e952a 100644
--- a/test/ruby/test_class.rb
+++ b/test/ruby/test_class.rb
@@ -769,4 +769,13 @@ class TestClass < Test::Unit::TestCase
assert(c.descendants.size <= 100)
end
end
+
+ def test_classext_memory_leak
+ assert_no_memory_leak([], <<-PREP, <<-CODE, rss: true)
+code = proc { Class.new }
+1_000.times(&code)
+PREP
+3_000_000.times(&code)
+CODE
+ end
end