Only clear Ractor cache in child

This avoids a race condition where we were clearing the cache from
another ractor while it was in use. Oops!

Fixes this failure http://ci.rvm.jp/results/master@oci-aarch64/5750416
This commit is contained in:
John Hawthorn 2025-05-09 15:02:53 -07:00
parent 87b621bd5b
commit 3306d7d2f9
Notes: git 2025-05-09 23:16:07 +00:00

View file

@ -9218,7 +9218,9 @@ gc_malloc_allocations(VALUE self)
void rb_gc_impl_before_fork(void *objspace_ptr) { /* no-op */ }
void rb_gc_impl_after_fork(void *objspace_ptr, rb_pid_t pid) {
rb_gc_ractor_newobj_cache_foreach(gc_ractor_newobj_cache_clear, NULL);
if (pid == 0) { /* child process */
rb_gc_ractor_newobj_cache_foreach(gc_ractor_newobj_cache_clear, NULL);
}
}
VALUE rb_ident_hash_new_with_size(st_index_t size);