[ruby-core:122336] [Ruby Bug#21383] Prism leaks memory with invalid yield

Issue #21383 has been reported by peterzhu2118 (Peter Zhu). ---------------------------------------- Bug #21383: Prism leaks memory with invalid yield https://bugs.ruby-lang.org/issues/21383 * Author: peterzhu2118 (Peter Zhu) * Status: Open * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED ---------------------------------------- Fix: https://github.com/ruby/ruby/pull/13464 The following script leaks memory: ```ruby 10.times do 20_000.times do eval("class C; yield; end") rescue SyntaxError end puts `ps -o rss= -p #{$$}` end ``` Before: ``` 16464 25536 29424 35904 39552 44576 46736 51600 56096 59824 ``` After: ``` 13488 16160 18240 20528 19760 21808 21680 22272 22064 22336 ``` -- https://bugs.ruby-lang.org/

Issue #21383 has been updated by k0kubun (Takashi Kokubun). Backport changed from 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ruby_3_4 commit:cdb039d3e4f76ee01744814e5f08395835fa8e63 merged revision(s) commit:9f91f3617bab2ee220d298ddb874ef73b10dac23. ---------------------------------------- Bug #21383: Prism leaks memory with invalid yield https://bugs.ruby-lang.org/issues/21383#change-114028 * Author: peterzhu2118 (Peter Zhu) * Status: Closed * Backport: 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE ---------------------------------------- Fix: https://github.com/ruby/ruby/pull/13464 The following script leaks memory: ```ruby 10.times do 20_000.times do eval("class C; yield; end") rescue SyntaxError end puts `ps -o rss= -p #{$$}` end ``` Before: ``` 16464 25536 29424 35904 39552 44576 46736 51600 56096 59824 ``` After: ``` 13488 16160 18240 20528 19760 21808 21680 22272 22064 22336 ``` -- https://bugs.ruby-lang.org/
participants (2)
-
k0kubun (Takashi Kokubun)
-
peterzhu2118 (Peter Zhu)