Skip to content

Commit

Permalink
sync fstring_table for deletion
Browse files Browse the repository at this point in the history
Ractors can access this table simultaneously so we need to sync
accesses.
  • Loading branch information
ko1 committed Sep 18, 2020
1 parent 609e6ac commit dd5db6f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions string.c
Expand Up @@ -1378,8 +1378,13 @@ rb_str_free(VALUE str)
{
if (FL_TEST(str, RSTRING_FSTR)) {
st_data_t fstr = (st_data_t)str;
st_delete(rb_vm_fstring_table(), &fstr, NULL);
RB_DEBUG_COUNTER_INC(obj_str_fstr);

RB_VM_LOCK_ENTER();
{
st_delete(rb_vm_fstring_table(), &fstr, NULL);
RB_DEBUG_COUNTER_INC(obj_str_fstr);
}
RB_VM_LOCK_LEAVE();
}

if (STR_EMBED_P(str)) {
Expand Down

0 comments on commit dd5db6f

Please sign in to comment.