Fix memory leak of Ractor ports
Memory leak reported: 3 miniruby 0x1044b6c1c ractor_init + 164 ractor.c:460 2 miniruby 0x1043fd6a0 ruby_xmalloc + 44 gc.c:5188 1 miniruby 0x104402840 rb_gc_impl_malloc + 148 default.c:8140 0 libsystem_malloc.dylib 0x19ab3912c _malloc_zone_malloc_instrumented_or_legacy + 152
This commit is contained in:
parent
7a40f1f06c
commit
89d49433a9
Notes:
git
2025-06-03 19:48:52 +00:00
@ -660,6 +660,16 @@ ractor_sync_mark(rb_ractor_t *r)
|
||||
ractor_mark_monitors(r);
|
||||
}
|
||||
|
||||
static int
|
||||
ractor_sync_free_ports_i(st_data_t _key, st_data_t val, st_data_t _args)
|
||||
{
|
||||
struct ractor_queue *queue = (struct ractor_queue *)val;
|
||||
|
||||
ractor_queue_free(queue);
|
||||
|
||||
return ST_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
ractor_sync_free(rb_ractor_t *r)
|
||||
{
|
||||
@ -669,6 +679,7 @@ ractor_sync_free(rb_ractor_t *r)
|
||||
|
||||
// maybe NULL
|
||||
if (r->sync.ports) {
|
||||
st_foreach(r->sync.ports, ractor_sync_free_ports_i, 0);
|
||||
st_free_table(r->sync.ports);
|
||||
r->sync.ports = NULL;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user