aboutsummaryrefslogtreecommitdiffstats
path: root/ractor_core.h
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2021-06-29 14:32:50 -0400
committerPeter Zhu <peter@peterzhu.ca>2021-07-15 11:48:52 -0400
commit4a627dbdfd1165022fa9e716ba845e937b03773d (patch)
tree2dd5c738728ffb2e64816f8a4ffefc82acdc38aa /ractor_core.h
parent119697f61e2b2b157816a8aa33aada5863959900 (diff)
downloadruby-4a627dbdfd1165022fa9e716ba845e937b03773d.tar.gz
[Bug #18014] Fix memory leak in GC when using Ractors
When a Ractor is removed, the freelist in the Ractor cache is not returned to the GC, leaving the freelist permanently lost. This commit recycles the freelist when the Ractor is destroyed, preventing a memory leak from occurring.
Diffstat (limited to 'ractor_core.h')
-rw-r--r--ractor_core.h5
1 files changed, 1 insertions, 4 deletions
diff --git a/ractor_core.h b/ractor_core.h
index 63279ebb98..879d8683fe 100644
--- a/ractor_core.h
+++ b/ractor_core.h
@@ -139,10 +139,7 @@ struct rb_ractor_struct {
VALUE verbose;
VALUE debug;
- struct {
- struct RVALUE *freelist;
- struct heap_page *using_page;
- } newobj_cache;
+ rb_ractor_newobj_cache_t newobj_cache;
// gc.c rb_objspace_reachable_objects_from
struct gc_mark_func_data_struct {