diff options
author | Peter Zhu <[email protected]> | 2024-01-08 10:09:13 -0500 |
---|---|---|
committer | Peter Zhu <[email protected]> | 2024-01-08 19:50:34 -0500 |
commit | 37ed86fd3c798e298fad9db6e7df1f3f45e1e03b (patch) | |
tree | 4f11b417a69e2d476f39d3a46870a5fcb538dfda /ast.c | |
parent | 0a30fc6211230f23a84d63344cba32e879ab4770 (diff) |
Fix memory leak in regexp grapheme clusters
[Bug #20161]
The cc->mbuf gets overwritten, so we need to free it to not leak memory.
For example:
str = "hello world".encode(Encoding::UTF_32LE)
10.times do
1_000.times do
str.grapheme_clusters
end
puts `ps -o rss= -p #{$$}`
end
Before:
15536
15760
15920
16144
16304
16480
16640
16784
17008
17280
After:
15584
15584
15760
15824
15888
15888
15888
15888
16048
16112
Diffstat (limited to 'ast.c')
0 files changed, 0 insertions, 0 deletions