Actions
Bug #20650
closedMemory leak in Regexp capture group when timeout
Bug #20650:
Memory leak in Regexp capture group when timeout
Description
GitHub PR: https://github.com/ruby/ruby/pull/11238
The capture group allocates memory that is leaked when it times out.
For example:
re = Regexp.new("^#{"(a*)" * 10_000}x$", timeout: 0.000001)
str = "a" * 1000000 + "x"
10.times do
100.times do
re =~ str
rescue Regexp::TimeoutError
end
puts `ps -o rss= -p #{$$}`
end
Before:
After:
Actions