Branch: Tag:

2003-01-14

2003-01-14 19:20:24 by Martin Stjernholm <mast@lysator.liu.se>

Reintroduced last_gc since it's useful to have in _gc_status(). Made it
possible to completely turn off the gc, not just the automatic scheduling.

Rev: src/builtin.cmod:1.107
Rev: src/gc.c:1.197
Rev: src/gc.h:1.96

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin.cmod,v 1.106 2003/01/12 16:00:13 mast Exp $ + || $Id: builtin.cmod,v 1.107 2003/01/14 19:20:24 mast Exp $   */      #include "global.h"
372:    *!    *! @mapping    *! @member int "enabled" -  *! All automatically scheduled gc runs are disabled if this is zero -  *! and the parameters below have no effect. Explicit runs through -  *! the @[gc] function still works as usual. +  *! If this is 1 then the gc is enabled as usual. If it's 0 then all +  *! automatically scheduled gc runs are disabled and the parameters +  *! below have no effect, but explicit runs through the @[gc] +  *! function still works as usual. If it's -1 then the gc is +  *! completely disabled so that even explicit @[gc] calls won't do +  *! anything.    *! @member float "garbage_ratio_low"    *! As long as the gc time is less than gc_time_ratio, aim to run    *! the gc approximately every time the ratio between the garbage
427:    if (set->type != T_FLOAT || \    set->u.float_number < 0.0 || set->u.float_number > 1.0) \    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1, \ -  "float value between 0.0 and 1.0 for " NAME); \ +  "float between 0.0 and 1.0 for " NAME); \    VAR = set->u.float_number; \    }, { \    get.type = T_FLOAT; \
435:    });       HANDLE_PARAM ("enabled", { -  if (gc_enabled != !UNSAFE_IS_ZERO (set)) { -  if (gc_enabled) { -  gc_enabled = 0; +  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;    alloc_threshold = GC_MAX_ALLOC_THRESHOLD;    }    else {