[前][次][番号順一覧][スレッド一覧]

ruby-changes:51363

From: normal <ko1@a...>
Date: Tue, 5 Jun 2018 09:37:10 +0900 (JST)
Subject: [ruby-changes:51363] normal:r63569 (trunk): gc.c: zero check for malloc_limit_max to initialization

normal	2018-06-05 09:37:05 +0900 (Tue, 05 Jun 2018)

  New Revision: 63569

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63569

  Log:
    gc.c: zero check for malloc_limit_max to initialization
    
    Repeatedly checking for malloc_limit_max in gc_reset_malloc_info
    is unnecessary, check and set it once during initialization
    in ruby_gc_set_params to simplify the hotter path
    
    * gc.c (gc_reset_malloc_info): remove zero check
      (ruby_gc_set_params): treat malloc_limit_max==0 as SIZE_MAX

  Modified files:
    trunk/gc.c
Index: gc.c
===================================================================
--- gc.c	(revision 63568)
+++ gc.c	(revision 63569)
@@ -6336,8 +6336,7 @@ gc_reset_malloc_info(rb_objspace_t *objs https://github.com/ruby/ruby/blob/trunk/gc.c#L6336
 
 	if (inc > malloc_limit) {
 	    malloc_limit = (size_t)(inc * gc_params.malloc_limit_growth_factor);
-	    if (gc_params.malloc_limit_max > 0 && /* ignore max-check if 0 */
-		malloc_limit > gc_params.malloc_limit_max) {
+	    if (malloc_limit > gc_params.malloc_limit_max) {
 		malloc_limit = gc_params.malloc_limit_max;
 	    }
 	}
@@ -7587,6 +7586,9 @@ ruby_gc_set_params(int safe_level) https://github.com/ruby/ruby/blob/trunk/gc.c#L7586
 
     get_envparam_size  ("RUBY_GC_MALLOC_LIMIT", &gc_params.malloc_limit_min, 0);
     get_envparam_size  ("RUBY_GC_MALLOC_LIMIT_MAX", &gc_params.malloc_limit_max, 0);
+    if (!gc_params.malloc_limit_max) { /* ignore max-check if 0 */
+        gc_params.malloc_limit_max = SIZE_MAX;
+    }
     get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0, 0.0, FALSE);
 
 #if RGENGC_ESTIMATE_OLDMALLOC

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]