Actions
Bug #18065
closed3.0.2 - possible memory leak in Hash#transform_keys!
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
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.
Actions
Like0
Like0Like0Like0