summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-03 15:02:58 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-03 15:02:58 +0000
commit3973e70d92aa2148edf05180f347c188fa9f0642 (patch)
treea5958644e46676bc71beb2ce2902c6ba8b505e0b
parent3e6a5b27f02ca51ae3502f64575937aa6c34dcdc (diff)
* gc.c (rb_gc_set_params): output GC parameter change messages only
if -w/-v options are specified. these messages are output to stderr, not to stdout. [ruby-core:39795] [Bug #5380] * test/ruby/test_gc.rb (test_gc_parameter): add test for it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--gc.c11
-rw-r--r--test/ruby/test_gc.rb8
3 files changed, 23 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9abab6038f..34df1fa040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Mon Oct 3 23:56:39 2011 CHIKANAGA Tomoyuki <nagachika00@gmail.com>
+
+ * gc.c (rb_gc_set_params): output GC parameter change messages only
+ if -w/-v options are specified. these messages are output to stderr,
+ not to stdout. [ruby-core:39795] [Bug #5380]
+
+ * test/ruby/test_gc.rb (test_gc_parameter): add test for it.
+
Sun Oct 2 20:05:32 2011 Kazuki Tsujimoto <kazuki@callcc.net>
* vm.c (rb_thread_mark), cont.c (cont_mark): revert r33369 and r33371
diff --git a/gc.c b/gc.c
index 1fce29ae6e..9f9d6b884a 100644
--- a/gc.c
+++ b/gc.c
@@ -427,7 +427,9 @@ rb_gc_set_params(void)
malloc_limit_ptr = getenv("RUBY_GC_MALLOC_LIMIT");
if (malloc_limit_ptr != NULL) {
int malloc_limit_i = atoi(malloc_limit_ptr);
- printf("malloc_limit=%d (%d)\n", malloc_limit_i, initial_malloc_limit);
+ if (ruby_verbose)
+ fprintf(stderr, "malloc_limit=%d (%d)\n",
+ malloc_limit_i, initial_malloc_limit);
if (malloc_limit_i > 0) {
initial_malloc_limit = malloc_limit_i;
}
@@ -436,7 +438,9 @@ rb_gc_set_params(void)
heap_min_slots_ptr = getenv("RUBY_HEAP_MIN_SLOTS");
if (heap_min_slots_ptr != NULL) {
int heap_min_slots_i = atoi(heap_min_slots_ptr);
- printf("heap_min_slots=%d (%d)\n", heap_min_slots_i, initial_heap_min_slots);
+ if (ruby_verbose)
+ fprintf(stderr, "heap_min_slots=%d (%d)\n",
+ heap_min_slots_i, initial_heap_min_slots);
if (heap_min_slots_i > 0) {
initial_heap_min_slots = heap_min_slots_i;
initial_expand_heap(&rb_objspace);
@@ -446,7 +450,8 @@ rb_gc_set_params(void)
free_min_ptr = getenv("RUBY_FREE_MIN");
if (free_min_ptr != NULL) {
int free_min_i = atoi(free_min_ptr);
- printf("free_min=%d (%d)\n", free_min_i, initial_free_min);
+ if (ruby_verbose)
+ fprintf(stderr, "free_min=%d (%d)\n", free_min_i, initial_free_min);
if (free_min_i > 0) {
initial_free_min = free_min_i;
}
diff --git a/test/ruby/test_gc.rb b/test/ruby/test_gc.rb
index b294c5445e..736f9349d3 100644
--- a/test/ruby/test_gc.rb
+++ b/test/ruby/test_gc.rb
@@ -86,6 +86,12 @@ class TestGc < Test::Unit::TestCase
"RUBY_GC_MALLOC_LIMIT" => "60000000",
"RUBY_HEAP_MIN_SLOTS" => "100000"
}
- assert_normal_exit("1", "[ruby-core:39777]", :child_env => env)
+ assert_normal_exit("exit", "[ruby-core:39777]", :child_env => env)
+
+ env = {
+ "RUBY_HEAP_MIN_SLOTS" => "100000"
+ }
+ assert_in_out_err([env, "-e", "exit"], "", [], [], "[ruby-core:39795]")
+ assert_in_out_err([env, "-w", "-e", "exit"], "", [], /heap_min_slots=100000/, "[ruby-core:39795]")
end
end