ruby-changes:49450
From: shyouhei <ko1@a...>
Date: Tue, 2 Jan 2018 21:39:35 +0900 (JST)
Subject: [ruby-changes:49450] shyouhei:r61561 (trunk): fix memory leak (FOUND BY A COMPILER WARNING)
shyouhei 2018-01-02 15:41:57 +0900 (Tue, 02 Jan 2018) New Revision: 61561 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61561 Log: fix memory leak (FOUND BY A COMPILER WARNING) Confusion of argument order ignores this st_free_table. Results in garbaged table not GCed. Easily noticable when you read the compiper warnings. Modified files: trunk/array.c Index: array.c =================================================================== --- array.c (revision 61560) +++ array.c (revision 61561) @@ -4953,7 +4953,7 @@ rb_ary_sample(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/array.c#L4953 long max_idx = 0; #undef RUBY_UNTYPED_DATA_WARNING #define RUBY_UNTYPED_DATA_WARNING 0 - VALUE vmemo = Data_Wrap_Struct(0, 0, 0, st_free_table); + VALUE vmemo = Data_Wrap_Struct(0, 0, st_free_table, 0); st_table *memo = st_init_numtable_with_size(n); DATA_PTR(vmemo) = memo; result = rb_ary_new_capa(n); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/