diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-21 03:26:47 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-09-21 03:26:47 +0000 |
commit | dfa336cd7ddc437314f36ce505c29e0e0d93659f (patch) | |
tree | bd40ea7c65ac33345fef131f217f5e40ea13e7e6 /file.c | |
parent | 5be5db63503251aa900386757e1a46a99b5052ec (diff) | |
download | ruby-dfa336cd7ddc437314f36ce505c29e0e0d93659f.tar.gz |
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
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47664 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -5609,6 +5609,7 @@ rb_find_file_ext_safe(VALUE *filep, const char *const *ext, int safe_level) } 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_level) if (rb_file_load_ok(f)) goto found; } } + rb_str_resize(tmp, 0); return 0; } else { |