Project

General

Profile

Actions

Bug #21383

closed

Prism leaks memory with invalid yield

Added by peterzhu2118 (Peter Zhu) about 1 month ago. Updated about 1 month ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:<unknown>]

Description

Fix: https://github.com/ruby/ruby/pull/13464

The following script leaks memory:

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
Actions #1

Updated by peterzhu2118 (Peter Zhu) about 1 month ago

  • Status changed from Open to Closed

Applied in changeset git|9f91f3617bab2ee220d298ddb874ef73b10dac23.


Fix memory leak with invalid yield in prism

[Bug #21383]

The following script leaks memory:

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
Actions

Also available in: Atom PDF

Like0
Like0