summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorHParker <HParker@github.com>2023-12-14 12:03:00 -0800
committerPeter Zhu <peter@peterzhu.ca>2023-12-15 10:31:15 -0500
commit474b4c42f4d1c36d94548548e03f6649f2119f67 (patch)
tree4728bbb61e435983e68a2dcc0d3cc95e30ddf586 /gc.c
parent049a9bd62f0907caa8d2eca6337cd2542a5c7726 (diff)
free ractors with ractor_free
Previously with RUBY_FREE_ON_EXIT, ractors where being xfree-ed which is incorrect since they are not xmalloced. Instead we can free ractors with ractor free during shutdown. This change only effects main ractor freeing when RUBY_FREE_ON_EXIT is set. Co-authored-by: John Hawthorn <john@hawthorn.email>
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gc.c b/gc.c
index 49e01bbd00..3a1ac4f4b9 100644
--- a/gc.c
+++ b/gc.c
@@ -4607,7 +4607,7 @@ rb_objspace_free_objects(rb_objspace_t *objspace)
VALUE vp = (VALUE)p;
switch (BUILTIN_TYPE(vp)) {
case T_DATA: {
- if (rb_obj_is_mutex(vp) || rb_obj_is_thread(vp)) {
+ if (rb_obj_is_mutex(vp) || rb_obj_is_thread(vp) || rb_obj_is_main_ractor(vp)) {
obj_free(objspace, vp);
}
break;