Skip to content

Commit

Permalink
Delete ID from constant cache table if it becomes empty on ISEQ free
Browse files Browse the repository at this point in the history
Co-authored-by: John Hawthorn <john@hawthorn.email>
  • Loading branch information
2 people authored and tenderlove committed Mar 24, 2022
1 parent 6299085 commit 8f6eaca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions iseq.c
Expand Up @@ -129,6 +129,11 @@ iseq_clear_ic_references_i(VALUE *code, VALUE insn, size_t index, void *data)

if (rb_id_table_lookup(vm->constant_cache, id, (VALUE *) &ics)) {
st_delete(ics, (st_data_t *) &ic_data->ic, (st_data_t *) NULL);

if (ics->num_entries == 0) {
rb_id_table_delete(vm->constant_cache, id);
st_free_table(ics);
}
}

return true;
Expand Down

0 comments on commit 8f6eaca

Please sign in to comment.