ruby-changes:65634
From: Aaron <ko1@a...>
Date: Wed, 24 Mar 2021 05:10:39 +0900 (JST)
Subject: [ruby-changes:65634] 417c648f08 (master): Free iv index table
https://git.ruby-lang.org/ruby.git/commit/?id=417c648f08 From 417c648f084713e2d6fd8d6d267a7114b711ba70 Mon Sep 17 00:00:00 2001 From: Aaron Patterson <tenderlove@r...> Date: Tue, 23 Mar 2021 12:02:27 -0700 Subject: Free iv index table IV index tables weren't being freed. This program would leak memory: ```ruby loop do k = Class.new do def initialize @a = 1 @b = 1 @c = 1 @d = 1 @e = 1 @f = 1 @g = 1 end end k.new end ``` This commit fixes the leak. --- gc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gc.c b/gc.c index 1f161b8..f7deedc 100644 --- a/gc.c +++ b/gc.c @@ -2628,6 +2628,7 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L2628 iv_index_tbl_free(struct st_table *tbl) { st_foreach(tbl, free_iv_index_tbl_free_i, 0); + st_free_table(tbl); } // alive: if false, target pointers can be freed already. -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/