diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2024-01-18 09:51:45 -0500 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2024-01-18 10:35:46 -0500 |
| commit | 00814fd6724fff66a10966f5be10ea6dae06c616 (patch) | |
| tree | 298f19a6227f63bc94cfacaa3f9e3ea22b95e6b9 /test/ruby | |
| parent | ef685554c90e78f1ce8ed3a26745b0bd58df278e (diff) | |
[PRISM] Fix memory leak in iseq
rb_iseq_compile_prism_node calls both rb_translate_prism and iseq_setup.
Both of these functions call iseq_set_sequence. This means that the first
iseq_set_sequence will leak because the iseq will be overwritten.
For example:
10.times do
100_000.times do
RubyVM::InstructionSequence.compile_prism("")
end
puts `ps -o rss= -p #{$$}`
end
Before:
20528
27328
33840
40208
46400
52960
59168
65600
71888
78352
After:
13696
13712
13712
13712
13712
14352
14352
14992
14992
14992
Diffstat (limited to 'test/ruby')
0 files changed, 0 insertions, 0 deletions
