* 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.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44853 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2014-02-06 00:04:14 +00:00
Родитель 2d603f9fee
Коммит f167bc403d
2 изменённых файлов: 20 добавлений и 4 удалений

Просмотреть файл

@ -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> Thu Feb 6 08:23:28 2014 Eric Wong <e@80x24.org>
* ext/thread/thread.c (rb_szqueue_max_set): use correct queue and * ext/thread/thread.c (rb_szqueue_max_set): use correct queue and

13
gc.c
Просмотреть файл

@ -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,
(unsigned int)objspace->rgengc.oldmalloc_increase_limit, (unsigned int)objspace->rgengc.oldmalloc_increase_limit,
(unsigned int)gc_params.oldmalloc_limit_max); (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) { if (ptr != NULL) {
val = atoi(ptr); 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); if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%d (%d)\n", name, val, *default_value);
*default_value = val; *default_value = val;
return 1; return 1;
@ -5671,7 +5673,7 @@ get_envparam_double(const char *name, double *default_value, double lower_bound)
if (ptr != NULL) { if (ptr != NULL) {
val = strtod(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); if (RTEST(ruby_verbose)) fprintf(stderr, "%s=%f (%f)\n", name, val, *default_value);
*default_value = val; *default_value = val;
return 1; 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); get_envparam_double("RUBY_GC_MALLOC_LIMIT_GROWTH_FACTOR", &gc_params.malloc_limit_growth_factor, 1.0);
#ifdef RGENGC_ESTIMATE_OLDMALLOC #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_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); get_envparam_double("RUBY_GC_OLDMALLOC_LIMIT_GROWTH_FACTOR", &gc_params.oldmalloc_limit_growth_factor, 1.0);
#endif #endif