summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenichi Kamiya <kachick1@gmail.com>2021-03-28 14:09:52 +0900
committerGitHub <noreply@github.com>2021-03-28 14:09:52 +0900
commit522d4cd32f7727886f4fcbc28ed29c08d361ee20 (patch)
treee631fef0746bf848bd95f05610181f19cc05679d
parent9af57eeed61ad53c0a2a92a93a6a6e40704cd6ae (diff)
Force recycle intermediate collection in Hash#transform_keys! [Bug #17735]
* Force recycle intermediate hash * Force recycle intermediate array too https://github.com/ruby/ruby/pull/4329#issuecomment-808840718
Notes
Notes: Merged-By: nobu <nobu@ruby-lang.org>
-rw-r--r--hash.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hash.c b/hash.c
index 17864a0..60fad03 100644
--- a/hash.c
+++ b/hash.c
@@ -3294,7 +3294,9 @@ rb_hash_transform_keys_bang(int argc, VALUE *argv, VALUE hash)
rb_hash_aset(new_keys, new_key, Qnil);
}
rb_ary_clear(pairs);
+ rb_gc_force_recycle(pairs);
rb_hash_clear(new_keys);
+ rb_gc_force_recycle(new_keys);
}
return hash;
}