Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Commit

Permalink
Force recycle intermediate collection in Hash#transform_keys! [Bug #1…
Browse files Browse the repository at this point in the history
…7735]

* Force recycle intermediate hash

* Force recycle intermediate array too

ruby#4329 (comment)
  • Loading branch information
kachick committed Mar 28, 2021
1 parent 9af57ee commit 522d4cd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 522d4cd

Please sign in to comment.