Skip to content

Commit

Permalink
Use objspace lock during newobj cache miss
Browse files Browse the repository at this point in the history
  • Loading branch information
rm155 committed Sep 23, 2024
1 parent f37e244 commit 3890951
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions gc/default.c
Original file line number Diff line number Diff line change
Expand Up @@ -2657,6 +2657,7 @@ newobj_cache_miss(rb_objspace_t *objspace, rb_ractor_newobj_cache_t *cache, size
rb_heap_t *heap = SIZE_POOL_EDEN_HEAP(size_pool);
VALUE obj = Qfalse;

OBJSPACE_LOCK_ENTER(objspace);
{
if (is_incremental_marking(objspace)) {
gc_continue(objspace, size_pool, heap);
Expand All @@ -2675,6 +2676,7 @@ newobj_cache_miss(rb_objspace_t *objspace, rb_ractor_newobj_cache_t *cache, size
obj = ractor_cache_allocate_slot(objspace, cache, size_pool_idx, false);
}
}
OBJSPACE_LOCK_LEAVE(objspace);

if (RB_UNLIKELY(obj == Qfalse)) {
rb_memerror();
Expand Down

0 comments on commit 3890951

Please sign in to comment.