diff options
| author | John Hawthorn <john@hawthorn.email> | 2024-12-19 16:13:18 -0800 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2024-12-20 14:21:57 -0800 |
| commit | 018b77503936370174d30b5c8cb2473d55fc35dd (patch) | |
| tree | 4e842e3b42758a6ad72d94e5847346fbf5682508 | |
| parent | 36966456c728b4faba8aa7c853cdccdfcf9a14ab (diff) | |
FREE_AT_EXIT: Free all allocations from fiber pool
The fiber pool allocations form a singly-linked list, so when we're
running with RUBY_FREE_AT_EXIT we need to walk the linked list freeing
each element, otherwise it can be detected as a memory leak.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12405
| -rw-r--r-- | cont.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -277,7 +277,12 @@ static struct fiber_pool shared_fiber_pool = {NULL, NULL, 0, 0, 0, 0}; void rb_free_shared_fiber_pool(void) { - xfree(shared_fiber_pool.allocations); + struct fiber_pool_allocation *allocations = shared_fiber_pool.allocations; + while (allocations) { + struct fiber_pool_allocation *next = allocations->next; + xfree(allocations); + allocations = next; + } } static ID fiber_initialize_keywords[3] = {0}; |
