summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2026-05-08 14:12:01 -0700
committerJohn Hawthorn <john@hawthorn.email>2026-05-14 07:07:45 -0700
commitbea03284ec08decdc5024228b1aadb82b16ab715 (patch)
treee8cd64d6bdcd9292777e9cdd95a19d3448f56180 /test
parent44dc905f50a62bd0d299d43e69b59aaf55dbada7 (diff)
Stack-allocate onig region for match
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_regexp.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index b519872d67..805c57b472 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1011,6 +1011,18 @@ class TestRegexp < Test::Unit::TestCase
end;
end
+ def test_regsub_no_memory_leak_many_captures
+ assert_no_memory_leak([], "#{<<~"begin;"}", "#{<<~"end;"}", rss: true)
+ code = proc do
+ "aaaaaaaaaaa".gsub(/(a)(b)?(c)?(d)?(e)?(f)?(g)?(h)?/, "")
+ end
+
+ 1_000.times(&code)
+ begin;
+ 100_000.times(&code)
+ end;
+ end
+
def test_ignorecase
v = assert_deprecated_warning(/variable \$= is no longer effective/) { $= }
assert_equal(false, v)