ruby-changes:35582
From: normal <ko1@a...>
Date: Sun, 21 Sep 2014 12:26:53 +0900 (JST)
Subject: [ruby-changes:35582] normal:r47664 (trunk): file.c: clear tmp buffer on failures
normal 2014-09-21 12:26:47 +0900 (Sun, 21 Sep 2014) New Revision: 47664 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47664 Log: file.c: clear tmp buffer on failures Reduces GC malloc pressure (MAXPATHLEN is 4096 on my system), rb_find_file_safe hits this path at least twice every time ruby starts. * file.c (rb_find_file_ext_safe): clear tmp buffer on failure (rb_find_file_safe): ditto Modified files: trunk/ChangeLog trunk/file.c Index: ChangeLog =================================================================== --- ChangeLog (revision 47663) +++ ChangeLog (revision 47664) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Sep 21 12:19:29 2014 Eric Wong <e@8...> + + * file.c (rb_find_file_ext_safe): clear tmp buffer on failure + (rb_find_file_safe): ditto + Sat Sep 20 04:42:18 2014 Masaki Matsushita <glass.saga@g...> * lib/csv.rb: avoid unnecessary object allocations. Index: file.c =================================================================== --- file.c (revision 47663) +++ file.c (revision 47664) @@ -5609,6 +5609,7 @@ rb_find_file_ext_safe(VALUE *filep, cons https://github.com/ruby/ruby/blob/trunk/file.c#L5609 } rb_str_set_len(fname, fnlen); } + rb_str_resize(tmp, 0); RB_GC_GUARD(load_path); return 0; } @@ -5661,6 +5662,7 @@ rb_find_file_safe(VALUE path, int safe_l https://github.com/ruby/ruby/blob/trunk/file.c#L5662 if (rb_file_load_ok(f)) goto found; } } + rb_str_resize(tmp, 0); return 0; } else { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/