summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2024-10-15 15:46:23 -0400
committerPeter Zhu <peter@peterzhu.ca>2024-10-16 14:52:46 -0400
commit90aa6aefc4e351d3840cfd58872c5f42a11f4c7a (patch)
tree540628302525d673583a7ff25c6cf16e434d307f /lib
parent4621c9b8154533e96a3f53de823578b1e171aa03 (diff)
Fix memory leak in syntax error in prism
If there is a syntax error, there could be an ast_node in the result. This could get leaked if there is a syntax error so parsing could not complete (parsed is not set to true). For example, the following script leaks memory: 10.times do 10_000.times do eval("def foo(...) super(...) {}; end") rescue SyntaxError end puts `ps -o rss= -p #{$$}` end Before: 31328 42768 53856 65120 76208 86768 97856 109120 120208 131296 After: 20944 20944 20944 20944 20944 20944 20944 20944 20944 20944
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/11901
Diffstat (limited to 'lib')
0 files changed, 0 insertions, 0 deletions