pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:22:   #include "time_stuff.h"   #include "constants.h"   #include "interpret.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.101 2000/07/04 00:43:57 mast Exp $"); + RCSID("$Id: gc.c,v 1.102 2000/07/04 21:44:19 grubba Exp $");      /* Run garbage collect approximately every time    * 20 percent of all arrays, objects and programs is    * garbage.    */      #define GC_CONST 20   #define MIN_ALLOC_THRESHOLD 1000   #define MAX_ALLOC_THRESHOLD 10000000   #define MULTIPLIER 0.9
pike.git/src/gc.c:1555: Inside #if defined(PIKE_DEBUG)
   if ((m->flags & (GC_DO_FREE|GC_LIVE)) == GC_LIVE) live_ref++;    m->flags |= GC_DO_FREE;   #endif       return !(m->flags & GC_LIVE);   }      static void warn_bad_cycles()   {    JMP_BUF uwp; -  struct array *obj_arr = 0; +     if (!SETJMP(uwp)) {    struct marker *p;    unsigned cycle = 0; -  obj_arr = allocate_array(0); +  ONERROR err; +  struct array *obj_arr = allocate_array(0); +  +  SET_ONERROR(err, do_free_array, obj_arr);    for (p = kill_list; p;) {    if ((cycle = p->cycle)) {    push_object((struct object *) p->data);    obj_arr = append_array(obj_arr, --sp);    }    p = p->link;    if (p ? p->cycle != cycle : cycle) {    if (obj_arr->size >= 2) {    push_constant_text("gc");    push_constant_text("bad_cycle");    push_array(obj_arr);    SAFE_APPLY_MASTER("runtime_warning", 3);    pop_stack();    obj_arr = allocate_array(0);    }    else obj_arr = resize_array(obj_arr, 0);    }    if (!p) break;    } -  +  CALL_AND_UNSET_ONERROR(err);    }    UNSETJMP(uwp); -  if (obj_arr) free_array(obj_arr); +    }      int do_gc(void)   {    double tmp;    int objs, pre_kill_objs;    double multiplier;    struct array *a;    struct multiset *l;    struct mapping *m;    struct program *p;    struct object *o;   #ifdef PIKE_DEBUG   #ifdef HAVE_GETHRTIME -  hrtime_t gcstarttime; +  hrtime_t gcstarttime = 0;   #endif    unsigned destroy_count, obj_count;   #endif       if(Pike_in_gc) return 0;    init_gc();    Pike_in_gc=GC_PASS_PREPARE;   #ifdef PIKE_DEBUG    gc_debug = d_flag;   #endif
pike.git/src/gc.c:1667:       Pike_in_gc=GC_PASS_CHECK;    /* First we count internal references */    gc_check_all_arrays();    gc_check_all_multisets();    gc_check_all_mappings();    gc_check_all_programs();    gc_check_all_objects();      #ifdef PIKE_DEBUG -  if(master_object) gc_external_mark2(master_object,0," &master_object"); +  if(master_object) +  gc_external_mark2(master_object,0," &master_object"); +     {    extern struct mapping *builtin_constants;    if(builtin_constants)    gc_external_mark2(builtin_constants,0," &builtin_constants");    }   #endif       /* These callbacks are mainly for the check pass, but can also    * do things that are normally associated with the mark pass    */