From 7a40f1f06ce099455065dd98b2f8ce1d71946c6c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 3 Jun 2025 11:23:25 -0400 Subject: [PATCH] Fix memory leak of Ractor recv_queue Memory leak reported: 3 miniruby 0x104702c1c ractor_init + 164 ractor.c:460 2 miniruby 0x1046496a0 ruby_xmalloc + 44 gc.c:5188 1 miniruby 0x10464e840 rb_gc_impl_malloc + 148 default.c:8140 0 libsystem_malloc.dylib 0x19ab3912c _malloc_zone_malloc_instrumented_or_legacy + 152 --- ractor_sync.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ractor_sync.c b/ractor_sync.c index 57aea296c2..31ac2df4cf 100644 --- a/ractor_sync.c +++ b/ractor_sync.c @@ -663,6 +663,10 @@ ractor_sync_mark(rb_ractor_t *r) static void ractor_sync_free(rb_ractor_t *r) { + if (r->sync.recv_queue) { + ractor_queue_free(r->sync.recv_queue); + } + // maybe NULL if (r->sync.ports) { st_free_table(r->sync.ports);