Project

General

Profile

Actions

Bug #21004

closed

Memory leak with `new_locations_lambda_body`

Added by kddnewton (Kevin Newton) about 1 month ago. Updated about 1 month ago.

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

Description

You can find the valgrind output here: https://github.com/ruby/prism/actions/runs/12613463262/job/35151355503?pr=3363#step:5:505. It looks like the allocated lambda locations are leaking under certain circumstances. The leak looks to be introduced here: https://github.com/ruby/ruby/commit/fa2517451ec.

Updated by peterzhu2118 (Peter Zhu) about 1 month ago

  • Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONTNEED
Actions #2

Updated by peterzhu2118 (Peter Zhu) about 1 month ago

  • Status changed from Open to Closed

Applied in changeset git|dfc9e978fba886d9a9175534551b1fc7b4d22abd.


[Bug #21004] Fix memory leak with "it" in parse.y

Parsing -> do it end in parse.y leaks memory. We can see this in the
Valgrind output:

56 bytes in 1 blocks are definitely lost in loss record 1 of 6
    at 0x484E0DC: calloc (vg_replace_malloc.c:1675)
    by 0x188970: calloc1 (default.c:1472)
    by 0x188970: rb_gc_impl_calloc (default.c:8208)
    by 0x188970: ruby_xcalloc_body (gc.c:4598)
    by 0x18B8BC: ruby_xcalloc (gc.c:4592)
    by 0x21DCCA70: new_locations_lambda_body (ripper.y:12844)
    by 0x21DCCA70: ripper_yyparse (ripper.y:5194)
    by 0x21DDA521: rb_ruby_ripper_parse0 (ripper.y:15798)
Actions

Also available in: Atom PDF

Like0
Like0Like0