Project

General

Profile

Feature #18494 » 0002-ENV-RUBY_GC_.-changes-GC-parameters-dynamically.patch

normalperson (Eric Wong), 01/17/2022 11:15 PM

View differences:

hash.c
static void
reset_by_modified_env(const char *nam)
{
static char gc_var_pfx[] = "RUBY_GC_";
/*
* ENV['TZ'] = nil has a special meaning.
* TZ is no longer considered up-to-date and ruby call tzset() as needed.
......
*/
if (ENVMATCH(nam, TZ_ENV)) {
ruby_reset_timezone();
} else if (ENVNMATCH(nam, gc_var_pfx, sizeof(gc_var_pfx) - 1)) {
ENV_LOCK();
ruby_gc_set_params();
ENV_UNLOCK();
}
}
test/ruby/test_gc.rb
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_MAX=16000000/, "")
assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR=2.0/, "")
end
assert_in_out_err(["-w", "-e", <<-'end'], "", [], /RUBY_GC_MALLOC_LIMIT=1024/, "")
ENV['RUBY_GC_MALLOC_LIMIT'] = '1k'
end
end
def test_profiler_enabled
(2-2/3)