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.95 2000/06/12 21:41:41 mast Exp $"); + RCSID("$Id: gc.c,v 1.96 2000/06/12 23:00:31 mast 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:1247:    }    }       else {    /* A normal or weak cycle which will be destructed in    * arbitrary order. */    unsigned cycle = m->cycle ? m->cycle : ++last_cycle;    if (cycle == gc_rec_last->cycle)    CYCLE_DEBUG_MSG(m, "gc_cycle_push, old cycle");    else { +  unsigned replace_cycle = gc_rec_last->cycle;    CYCLE_DEBUG_MSG(m, "gc_cycle_push, cycle"); -  for (p = m;; p = p->link) { +  for (p = m; p != gc_rec_last; p = p->link) {    p->cycle = cycle;    CYCLE_DEBUG_MSG(p, "gc_cycle_push, mark cycle"); -  if (p == gc_rec_last) break; +  } +  if (replace_cycle != cycle) +  for (; p && p->cycle == replace_cycle; p = p->link) { +  p->cycle = cycle; +  CYCLE_DEBUG_MSG(p, "gc_cycle_push, re-mark cycle");    }}}} /* Mmm.. lisp ;) */       else /* A forward reference. */    if (m->flags & GC_ON_STACK) {    /* It's a reference to a marker that has been swapped    * further down the list by break_cycle(). In that case we    * must mark gc_rec_last to stay on the list. */    CYCLE_DEBUG_MSG(m, "gc_cycle_push, mark for don't pop");    gc_rec_last->flags |= GC_DONT_POP;    }