summaryrefslogtreecommitdiff
path: root/ractor_core.h
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2021-07-18 15:23:09 +0900
committernagachika <nagachika@ruby-lang.org>2021-07-22 11:47:00 +0900
commita215c6d0448764131cbbb48b476dc698b51c2273 (patch)
tree93492686fdf93e14d7694f543bb872cb37543dbf /ractor_core.h
parentc4b602e80fdc1824c68602302a4ed82a0e90d5b7 (diff)
partially merge revision(s) 119697f61e2b2b157816a8aa33aada5863959900,4a627dbdfd1165022fa9e716ba845e937b03773d: [Backport #18014]
[Bug #18014] Fix rb_gc_force_recycle unmark before sweep If we force recycle an object before the page is swept, we should clear it in the mark bitmap. If we don't clear it in the bitmap, then during sweeping we won't account for this free slot so the `free_slots` count of the page will be incorrect. --- gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) [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. --- gc.c | 116 +++++++++++++++++++++++++++------------------------------- internal/gc.h | 6 +++ ractor.c | 3 ++ ractor_core.h | 5 +-- 4 files changed, 64 insertions(+), 66 deletions(-) Co-authored-by: Peter Zhu <peter@peterzhu.ca>
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 2516277f4f..1ed6858c9f 100644
--- a/ractor_core.h
+++ b/ractor_core.h
@@ -138,10 +138,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 {