From 4a627dbdfd1165022fa9e716ba845e937b03773d Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 29 Jun 2021 14:32:50 -0400 Subject: [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. --- ractor_core.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ractor_core.h') 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 { -- cgit v1.2.3