[ruby-core:104818] [Ruby master Bug#18065] 3.0.2 - possible memory leak in Hash#transform_keys!
From:
merch-redmine@...
Date:
2021-08-07 01:06:49 UTC
List:
ruby-core #104818
Issue #18065 has been updated by jeremyevans0 (Jeremy Evans).
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 commit:84d9a9afc0b49d095541acb9832f8b12fb506e19.
----------------------------------------
Bug #18065: 3.0.2 - possible memory leak in Hash#transform_keys!
https://bugs.ruby-lang.org/issues/18065#change-93159
* Author: sean@duke.edu (Sean Dilda)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
* Backport: 2.6: DONTNEED, 2.7: DONTNEED, 3.0: REQUIRED
----------------------------------------
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.
```ruby
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.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>