diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | gc.c | 13 |
2 files changed, 20 insertions, 4 deletions
@@ -1,3 +1,14 @@ +Thu Feb 6 09:00:35 2014 Koichi Sasada <ko1@atdot.net> + + * 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@80x24.org> * ext/thread/thread.c (rb_szqueue_max_set): use correct queue and @@ -2921,7 +2921,9 @@ gc_before_sweep(rb_objspace_t *objspace) } } - 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, unsigned int *default_value, int lower_bound) 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, double *default_value, double lower_bound) 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) 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 |