[#116016] [Ruby master Bug#20150] Memory leak in grapheme clusters — "peterzhu2118 (Peter Zhu) via ruby-core" <ruby-core@...>
Issue #20150 has been reported by peterzhu2118 (Peter Zhu).
7 messages
2024/01/04
[#116382] [Ruby master Feature#20205] Enable `frozen_string_literal` by default — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>
Issue #20205 has been reported by byroot (Jean Boussier).
77 messages
2024/01/23
[ruby-core:116522] [Ruby master Bug#20228] Memory leak in Regexp timeout
From:
"mame (Yusuke Endoh) via ruby-core" <ruby-core@...>
Date:
2024-01-31 04:12:54 UTC
List:
ruby-core #116522
Issue #20228 has been updated by mame (Yusuke Endoh).
Good find, thanks!
I'm a little concerned about the overhead of `rb_protect` for a typical simple match, but it's neglectable?
----------------------------------------
Bug #20228: Memory leak in Regexp timeout
https://bugs.ruby-lang.org/issues/20228#change-106541
* Author: peterzhu2118 (Peter Zhu)
* Status: Open
* Priority: Normal
* Backport: 3.0: UNKNOWN, 3.1: DONTNEED, 3.2: REQUIRED, 3.3: REQUIRED
----------------------------------------
GitHub PR: https://github.com/ruby/ruby/pull/9765
If a Regexp::TimeoutError is raised, the `stk_base` and `OnigRegion` will leak.
For example:
```ruby
Regexp.timeout = 0.001
regex = /^(a*)*$/
str = "a" * 1000000 + "x"
10.times do
100.times do
begin
regex =~ str
rescue
end
end
puts `ps -o rss= -p #{$$}`
end
```
Before:
```
328800
632416
934368
1230448
1531088
1831248
2125072
2414384
2703440
2995664
```
After:
```
39280
47888
49024
56240
56496
56512
56592
56592
56720
56720
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/