Project

General

Profile

Actions

Bug #20521

closed

Memory leak in Ripper parsing

Added by kddnewton (Kevin Newton) 6 months ago. Updated 6 months ago.

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

Description

Currently, this code is leaking:

require "ripper"

source = <<~'RUBY'
<<-A; %w[j\
i
A
j]
RUBY

10.times do
  100_000.times do
    Ripper.sexp_raw(source)
  end

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

This results in:

 31584
 36304
 41504
 47008
 51712
 56384
 61088
 65792
 70480
 75200

I haven't managed to track it down, but I can see that 3.2.2 does not leak but 3.3.0 does leak.


Related issues 2 (0 open2 closed)

Related to Ruby master - Bug #18963: Ripper.tokenize(code).join != code when heredoc and multiline string is on the same lineClosedActions
Related to Ruby master - Bug #19835: Parser leaks memory for incomplete tokensClosedActions
Actions #2

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED
Actions #3

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Related to Bug #18963: Ripper.tokenize(code).join != code when heredoc and multiline string is on the same line added
Actions #4

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Related to Bug #19835: Parser leaks memory for incomplete tokens added
Actions #5

Updated by nobu (Nobuyoshi Nakada) 6 months ago

  • Status changed from Open to Closed

Applied in changeset git|27321290d954300192c82cdf5e2c794a695473f5.


[Bug #20521] ripper: Clean up strterm

Updated by k0kubun (Takashi Kokubun) 6 months ago

  • Backport changed from 3.1: DONTNEED, 3.2: DONTNEED, 3.3: REQUIRED to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONE

ruby_3_3 23f4b78ad8844ec81cb02fad25a6247a2d498582 merged revision(s) 27321290.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0