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.80 2000/04/23 03:17:11 mast Exp $"); + RCSID("$Id: gc.c,v 1.81 2000/04/26 12:13:56 mast Exp $");      /* Run garbage collect approximate every time we have    * 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:975:       last_gc=TIME(0);       multiplier=pow(MULTIPLIER, (double) num_allocs / (double) alloc_threshold);    objects_alloced*=multiplier;    objects_alloced += (double) num_allocs;       objects_freed*=multiplier;    objects_freed += (double) num_objects;    +  /* Thread switches and object alloc/free are disallowed now. */ +    #ifdef PIKE_DEBUG    if (gc_debug) {    INT32 n;    Pike_in_gc = GC_PASS_PRETOUCH;    n = gc_touch_all_arrays();    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects();    if (n != num_objects)
pike.git/src/gc.c:1027:    gc_mark_all_mappings();    run_queue(&gc_mark_queue);    gc_mark_all_programs();    run_queue(&gc_mark_queue);    gc_mark_all_objects();    run_queue(&gc_mark_queue);       if(d_flag)    gc_mark_all_strings();    +  /* Thread switches and object alloc/free are allowed now. */ +    #ifdef PIKE_DEBUG    check_for=(void *)1;   #endif    Pike_in_gc=GC_PASS_FREE;    /* Now we free the unused stuff */    gc_free_all_unreferenced_arrays();    gc_free_all_unreferenced_multisets();    gc_free_all_unreferenced_mappings();    gc_free_all_unreferenced_programs(); -  Pike_in_gc=GC_PASS_DESTROY; /* Pike code allowed in this pass. */ +  Pike_in_gc=GC_PASS_DESTROY;    /* This is intended to happen before the freeing done above. But    * it's put here for the time being, since the problem of non-object    * objects getting external references from destroy code isn't    * solved yet. */    destroyed = gc_destroy_all_unreferenced_objects();    Pike_in_gc=GC_PASS_FREE;    destructed = gc_free_all_unreferenced_objects();      #ifdef PIKE_DEBUG    if (destroyed != destructed)    fatal("destroy() called in %d objects in gc, but %d destructed.\n",    destroyed, destructed);    check_for=0;    if(fatal_after_gc) fatal(fatal_after_gc);   #endif       Pike_in_gc=GC_PASS_DESTRUCT;    destruct_objects_to_destruct();    -  +  /* Thread switches and object alloc/free are disallowed now. */ +    #ifdef PIKE_DEBUG    if (gc_debug) {    INT32 n;    Pike_in_gc=GC_PASS_POSTTOUCH;    n = gc_touch_all_arrays();    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects();    if (n != num_objects)