Project

General

Profile

« Previous | Next » 

Revision 6898389a

Added by nagachika (Tomoyuki Chikanaga) almost 2 years ago

merge revision(s) 5bc8fceca8d47ed1ef9c603c6531a408de36b60c: [Backport #19835]

    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
    ```
    ---
     parse.y                    | 42 ++++++++++++++++++++++++++++--------------
     test/ripper/test_ripper.rb |  7 +++++++
     2 files changed, 35 insertions(+), 14 deletions(-)