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

ruby-changes:32774

From: ko1 <ko1@a...>
Date: Thu, 6 Feb 2014 09:04:19 +0900 (JST)
Subject: [ruby-changes:32774] ko1:r44853 (trunk): * gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,

ko1	2014-02-06 09:04:14 +0900 (Thu, 06 Feb 2014)

  New Revision: 44853

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=44853

  Log:
    * gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
      then set objspace->rgengc.oldmalloc_increase_limit.
      Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
      does not work.
    * gc.c (get_envparam_int): accept a value equals to lowerbounds.
    * gc.c (get_envparam_double): ditto.

  Modified files:
    trunk/ChangeLog
    trunk/gc.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 44852)
+++ ChangeLog	(revision 44853)
@@ -1,3 +1,14 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Feb  6 09:00:35 2014  Koichi Sasada  <ko1@a...>
+
+	* gc.c (ruby_gc_set_params): if RUBY_GC_OLDMALLOC_LIMIT is provided,
+	  then set objspace->rgengc.oldmalloc_increase_limit.
+	  Without this fix, the env variable RUBY_GC_OLDMALLOC_LIMIT
+	  does not work.
+
+	* gc.c (get_envparam_int): accept a value equals to lowerbounds.
+
+	* gc.c (get_envparam_double): ditto.
+
 Thu Feb 6 08:23:28 2014  Eric Wong  <e@8...>
 
 	* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and
Index: gc.c
===================================================================
--- gc.c	(revision 44852)
+++ gc.c	(revision 44853)
@@ -2921,7 +2921,9 @@ gc_before_sweep(rb_objspace_t *objspace) https://github.com/ruby/ruby/blob/trunk/gc.c#L2921
 	    }
 	}
 
-	if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n", (int)rb_gc_count(), objspace->rgengc.need_major_gc,
+	if (0) fprintf(stderr, "%d\t%d\t%u\t%u\t%d\n",
+		       (int)rb_gc_count(),
+		       (int)objspace->rgengc.need_major_gc,
 		       (unsigned int)objspace->rgengc.oldmalloc_increase,
 		       (unsigned int)objspace->rgengc.oldmalloc_increase_limit,
 		       (unsigned int)gc_params.oldmalloc_limit_max);
@@ -5651,7 +5653,7 @@ get_envparam_int(const char *name, unsig https://github.com/ruby/ruby/blob/trunk/gc.c#L5653
 
     if (ptr != NULL) {
 	val = atoi(ptr);
-	if (val > lower_bound) {
+	if (val >= lower_bound) {
 	    if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
 	    *default_value = val;
 	    return 1;
@@ -5671,7 +5673,7 @@ get_envparam_double(const char *name, do https://github.com/ruby/ruby/blob/trunk/gc.c#L5673
 
     if (ptr != NULL) {
 	val = strtod(ptr, NULL);
-	if (val > lower_bound) {
+	if (val >= lower_bound) {
 	    if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
 	    *default_value = val;
 	    return 1;
@@ -5752,7 +5754,10 @@ ruby_gc_set_params(int safe_level) https://github.com/ruby/ruby/blob/trunk/gc.c#L5754
     get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
 
 #ifdef RGENGC_ESTIMATE_OLDMALLOC
-    get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0);
+    if (get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT", &gc_params.oldmalloc_limit_min, 0)) {
+	rb_objspace_t *objspace = &rb_objspace;
+	objspace->rgengc.oldmalloc_increase_limit = gc_params.oldmalloc_limit_min;
+    }
     get_envparam_int("RUBY_GC_OLDMALLOC_LIMIT_MAX", &gc_params.oldmalloc_limit_max, 0);
     get_envparam_double("RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR", &gc_params.oldmalloc_limit_growth_factor, 1.0);
 #endif

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

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