diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-07-31 15:12:20 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-07-31 15:12:20 -0400 |
commit | c01b17f7fc74f005f23da0405eb8bad08a269a18 (patch) | |
tree | 90cae72e42ed235b4029d0197083ce65914a9291 | |
parent | 954b7ac81ef503df3c1efc5566df985b08951d52 (diff) | |
download | ruby-c01b17f7fc74f005f23da0405eb8bad08a269a18.tar.gz |
Fix default value of global_init_slots
Not setting a value to global_init_slots causes get_envparam_size to
output a broken default value.
-rw-r--r-- | gc.c | 2 | ||||
-rw-r--r-- | test/ruby/test_gc.rb | 2 |
2 files changed, 3 insertions, 1 deletions
@@ -11665,7 +11665,7 @@ ruby_gc_set_params(void) } /* RUBY_GC_HEAP_INIT_SLOTS */ - size_t global_init_slots; + size_t global_init_slots = GC_HEAP_INIT_SLOTS; if (get_envparam_size("RUBY_GC_HEAP_INIT_SLOTS", &global_init_slots, 0)) { for (int i = 0; i < SIZE_POOL_COUNT; i++) { gc_params.size_pool_init_slots[i] = global_init_slots; diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb index 8d315fa925..335fa77e93 100644 --- a/test/ruby/test_gc.rb +++ b/test/ruby/test_gc.rb @@ -345,6 +345,8 @@ class TestGc < Test::Unit::TestCase assert_in_out_err([env, "-W0", "-e", "exit"], "", [], [], "[ruby-core:39795]") assert_in_out_err([env, "-W1", "-e", "exit"], "", [], [], "[ruby-core:39795]") assert_in_out_err([env, "-w", "-e", "exit"], "", [], /RUBY_GC_HEAP_INIT_SLOTS=100000/, "[ruby-core:39795]") + # Value of GC_HEAP_INIT_SLOTS is 10000 + assert_in_out_err([env, "-w", "-e", "exit"], "", [], /\(default value: 10000\)/) env = { "RUBY_GC_HEAP_GROWTH_FACTOR" => "2.0", |