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.54 2000/04/14 15:53:07 grubba Exp $"); + RCSID("$Id: gc.c,v 1.55 2000/04/19 21:59:37 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   #define MARKER_CHUNK_SIZE 1023      INT32 num_objects =0;   INT32 num_allocs =0;   INT32 alloc_threshold = MIN_ALLOC_THRESHOLD; - static int in_gc = 0; + int Pike_in_gc = 0;   struct pike_queue gc_mark_queue;   time_t last_gc;         static double objects_alloced = 0.0;   static double objects_freed = 0.0;      struct callback_list gc_callbacks;      struct callback *debug_add_gc_callback(callback_func call,
pike.git/src/gc.c:76: Inside #if defined(PIKE_DEBUG)
     void dump_gc_info(void)   {    fprintf(stderr,"Current number of objects: %ld\n",(long)num_objects);    fprintf(stderr,"Objects allocated total : %ld\n",(long)num_allocs);    fprintf(stderr," threshold for next gc() : %ld\n",(long)alloc_threshold);    fprintf(stderr,"Average allocs per gc() : %f\n",objects_alloced);    fprintf(stderr,"Average frees per gc() : %f\n",objects_freed);    fprintf(stderr,"Second since last gc() : %ld\n", (long)TIME(0) - (long)last_gc);    fprintf(stderr,"Projected garbage : %f\n", objects_freed * (double) num_allocs / (double) alloc_threshold); -  fprintf(stderr,"in_gc : %d\n", in_gc); +  fprintf(stderr,"in_gc : %d\n", Pike_in_gc);   }      TYPE_T attempt_to_identify(void *something)   {    struct array *a;    struct object *o;    struct program *p;    struct mapping *m;    struct multiset *mu;   
pike.git/src/gc.c:571: Inside #if defined(DO_PIKE_CLEANUP)
   while(marker_hash_table[e])    remove_marker(marker_hash_table[e]->data);   #endif    exit_marker_hash();   #endif   }      #ifdef PIKE_DEBUG   void locate_references(void *a)   { -  if(!in_gc) +  if(!Pike_in_gc)    init_gc();       fprintf(stderr,"**Looking for references:\n");       check_for=a;       found_where=" in an array";    gc_check_all_arrays();       found_where=" in a multiset";
pike.git/src/gc.c:599: Inside #if defined(PIKE_DEBUG)
      found_where=" in an object";    gc_check_all_objects();       found_where=" in a module";    call_callback(& gc_callbacks, (void *)0);       found_where="";    check_for=0;    -  if(!in_gc) +  if(!Pike_in_gc)    exit_gc();   }   #endif      #ifdef PIKE_DEBUG      int debug_gc_is_referenced(void *a)   {    struct marker *m;    m=get_marker(a);
pike.git/src/gc.c:706: Inside #if defined(PIKE_DEBUG)
   return (m->flags & (GC_REFERENCED|GC_CHECKED)) == GC_CHECKED;   }   #endif      void do_gc(void)   {    double tmp;    INT32 tmp2;    double multiplier;    -  if(in_gc) return; -  in_gc=1; +  if(Pike_in_gc) return; +  Pike_in_gc=1;    -  +  /* Make sure there will be no callback to this while we're in the gc. */ +  destruct_objects_to_destruct(); +     if(gc_evaluator_callback)    {    remove_callback(gc_evaluator_callback);    gc_evaluator_callback=0;    }       tmp2=num_objects;      #ifdef PIKE_DEBUG    if(t_flag)
pike.git/src/gc.c:801: Inside #if defined(PIKE_DEBUG)
   if(t_flag)    fprintf(stderr,"done (freed %ld of %ld objects).\n",    (long)(tmp2-num_objects),(long)tmp2);   #endif      #ifdef ALWAYS_GC    ADD_GC_CALLBACK();   #else    if(d_flag > 3) ADD_GC_CALLBACK();   #endif -  in_gc=0; +  Pike_in_gc=0;   }         void f__gc_status(INT32 args)   {    pop_n_elems(args);       push_constant_text("num_objects");    push_int(num_objects);