pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:23:   #include "constants.h"   #include "interpret.h"   #include "bignum.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.152 2001/06/06 02:22:39 mast Exp $"); + RCSID("$Id: gc.c,v 1.153 2001/06/11 19:58:28 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:2199:    gc_zap_ext_weak_refs_in_programs();    GC_VERBOSE_DO(    fprintf(stderr,    "| zap weak: freed %ld external weak refs, %lu internal still around,\n"    "| %d things really freed\n",    PTRDIFF_T_TO_LONG(to_free - gc_ext_weak_refs),    SIZE_T_TO_ULONG(gc_ext_weak_refs), obj_count - num_objects));    }       /* Add an extra reference to the stuff gc_internal_* point to, so we -  * know they're still around when gc_free_all_unreferenced_* is +  * know they're still around when gc_free_all_unreferenced_* are    * about to be called. */ -  if (gc_internal_array != &empty_array) add_ref(gc_internal_array); +  if (gc_internal_array != &weak_empty_array) add_ref(gc_internal_array);    if (gc_internal_multiset) add_ref(gc_internal_multiset);    if (gc_internal_mapping) add_ref(gc_internal_mapping);    if (gc_internal_program) add_ref(gc_internal_program);    if (gc_internal_object) add_ref(gc_internal_object);       /* Thread switches, object alloc/free and reference changes are    * allowed again now. */       Pike_in_gc=GC_PASS_FREE;   #ifdef PIKE_DEBUG    weak_freed = 0;    obj_count = num_objects;   #endif       /* Now we free the unused stuff. The extra refs to gc_internal_*    * added above are removed just before the calls so we'll get the    * correct relative positions in them. */ -  if (gc_internal_array != &empty_array) { +  if (gc_internal_array != &weak_empty_array) {    FREE_AND_GET_REFERENCED(gc_internal_array, struct array, free_array);    gc_free_all_unreferenced_arrays();    }    if (gc_internal_multiset) {    FREE_AND_GET_REFERENCED(gc_internal_multiset, struct multiset, free_multiset);    gc_free_all_unreferenced_multisets();    }    if (gc_internal_mapping) {    FREE_AND_GET_REFERENCED(gc_internal_mapping, struct mapping, free_mapping);    gc_free_all_unreferenced_mappings();
pike.git/src/gc.c:2253: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    gc_internal_array = (struct array *) (ptrdiff_t) -1;    gc_internal_multiset = (struct multiset *) (ptrdiff_t) -1;    gc_internal_mapping = (struct mapping *) (ptrdiff_t) -1;    gc_internal_program = (struct program *) (ptrdiff_t) -1;    gc_internal_object = (struct object *) (ptrdiff_t) -1;       if(fatal_after_gc) fatal("%s", fatal_after_gc);   #endif    -  /* Pike code may run again now. */ -  +     Pike_in_gc=GC_PASS_KILL;    /* Destruct the live objects in cycles, but first warn about any bad    * cycles. */    pre_kill_objs = num_objects;    if (last_cycle) {    objs -= num_objects;    warn_bad_cycles();    objs += num_objects;    }   #ifdef PIKE_DEBUG