Project

General

Profile

Actions

Bug #19835

closed

Parser leaks memory for incomplete tokens

Added by peterzhu2118 (Peter Zhu) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:114377]

Description

GitHub Pull Request: https://github.com/ruby/ruby/pull/8192

The parser does not free the tbl of the struct vtable when there are leftover lvtbl in the parser. This causes a memory leak.

The following script reproduces this issue:

10.times do
  100_000.times do
    Ripper.parse("class Foo")
  end

  puts `ps -o rss= -p #{$$}`
end

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #20521: Memory leak in Ripper parsingClosedActions
Actions #1

Updated by peterzhu2118 (Peter Zhu) over 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|5bc8fceca8d47ed1ef9c603c6531a408de36b60c.


Fix memory leak in parser for incomplete tokens

[Bug #19835]

The parser does not free the tbl of the struct vtable when there are
leftover lvtbl in the parser. This causes a memory leak.

The following script reproduces this issue:

10.times do
  100_000.times do
    Ripper.parse("class Foo")
  end

  puts `ps -o rss= -p #{$$}`
end

Updated by nagachika (Tomoyuki Chikanaga) over 1 year ago

  • Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE

ruby_3_2 6898389a0f640c4155a7073579f43d1e16893698 merged revision(s) 5bc8fceca8d47ed1ef9c603c6531a408de36b60c.

Actions #3

Updated by nobu (Nobuyoshi Nakada) 7 months ago

  • Related to Bug #20521: Memory leak in Ripper parsing added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0