1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix crash on bootup when RGENGC_CHECK_MODE=2 with GC stress

We need to unshare the array loaded_features because the shared root
could be old gen (while loaded_features is young) which causes a WB
miss.
This commit is contained in:
Peter Zhu 2022-01-04 13:54:21 -05:00
parent 9c15da0fd4
commit 44379805b0
Notes: git 2022-01-05 04:46:42 +09:00

3
ruby.c
View file

@ -2062,7 +2062,10 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt)
for (long i = loaded_before_enc; i < RARRAY_LEN(loaded_features); ++i) {
VALUE path = RARRAY_AREF(loaded_features, i);
if (!(path = copy_str(path, IF_UTF8_PATH(uenc, lenc), true))) continue;
if (!modified) {
rb_ary_modify(loaded_features);
modified = true;
}
RARRAY_ASET(loaded_features, i, path);
}
if (modified) {