pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:577:    }, { \    get.type = T_FLOAT; \    get.u.float_number = DO_NOT_WARN ((FLOAT_TYPE) VAR); \    });       HANDLE_PARAM ("enabled", {    if (set->type != T_INT || set->u.integer < -1 || set->u.integer > 1)    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1,    "integer in the range -1..1 for 'enabled'");    if (gc_enabled != set->u.integer) { -  if (gc_enabled > 0) -  gc_enabled = set->u.integer; -  else { -  gc_enabled = 1; -  if (alloc_threshold == GC_MAX_ALLOC_THRESHOLD) -  alloc_threshold = GC_MIN_ALLOC_THRESHOLD; +  if (gc_enabled > 0) { +  /* Disabling automatic gc - save the old alloc_threshold and set it to +  * the maximum value to avoid getting gc_evaluator_callback added. */ +  saved_alloc_threshold = alloc_threshold; +  alloc_threshold = GC_MAX_ALLOC_THRESHOLD;    } -  +  else if (set->u.integer > 0) { +  /* Enabling automatic gc - restore the old alloc_threshold. If the +  * gc interval has gotten longer than it should be then the +  * multiplier calculation in do_gc should compensate. */ +  alloc_threshold = saved_alloc_threshold;    } -  +  gc_enabled = set->u.integer; +  }    }, {    get.type = T_INT;    get.subtype = NUMBER_NUMBER;    get.u.integer = gc_enabled;    });    HANDLE_FLOAT_FACTOR ("garbage_ratio_low", gc_garbage_ratio_low);    HANDLE_FLOAT_FACTOR ("time_ratio", gc_time_ratio);    HANDLE_FLOAT_FACTOR ("garbage_ratio_high", gc_garbage_ratio_high);    HANDLE_FLOAT_FACTOR ("min_gc_time_ratio", gc_min_time_ratio);    HANDLE_FLOAT_FACTOR ("average_slowness", gc_average_slowness);