Project

General

Profile

Actions

Bug #18065

closed

3.0.2 - possible memory leak in Hash#transform_keys!

Added by sean@duke.edu (Sean Dilda) about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
[ruby-core:104817]

Description

I found what may be a memory leak in Hash#transform_keys! in version 3.0.2

This sample code will reproduce the issue. It quickly consumes gigabytes of memory when running on 3.0.2, but has very normal memory usage on 3.0.1. I tested using the ruby:3.0.2 docker image.

h = { value1: 1, value2: 2 }
loop { h.transform_keys!(&:to_s) }

The issue doesn't appear if there is only one key in the hash.

Updated by jeremyevans0 (Jeremy Evans) about 1 year ago

  • Backport changed from 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN to 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED

It looks likely related to 84d9a9afc0b49d095541acb9832f8b12fb506e19.

Actions #2

Updated by nobu (Nobuyoshi Nakada) about 1 year ago

  • Status changed from Open to Closed

Applied in changeset git|e5dd40b1f3a11f48d566413ab347ce0cfdd94960.


Stop force-recycling evacuated array [Bug #18065]

Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago

  • Backport changed from 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED to 2.6: DONTNEED, 2.7: DONTNEED, 3.0: DONE

ruby_3_0 d6b8b37a2608a0fbb8bcfd10356bb25f9ebbe1fe merged revision(s) e5dd40b1f3a11f48d566413ab347ce0cfdd94960.

Actions

Also available in: Atom PDF