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.71 2000/04/19 18:06:45 mast Exp $"); + RCSID("$Id: gc.c,v 1.72 2000/04/19 21:25:33 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:144:    int indent,    int depth,    int flags)   {    struct program *p;    void *memblock=0;    int type=real_type;    if(!location) return;   /* fprintf(stderr,"**Location of (short) svalue: %p\n",location); */    -  if(real_type!=-1) real_memblock=memblock; +  if(real_type!=-1) memblock=real_memblock;      #ifdef DEBUG_MALLOC    if(memblock == 0 || type == -1)    {    extern void *dmalloc_find_memblock_base(void *);    memblock=dmalloc_find_memblock_base(location);    }   #endif       if(type==T_UNKNOWN)
pike.git/src/gc.c:499:    tmp=d_flag;    d_flag=0;      #ifdef DEBUG_MALLOC    if (((int)a) == 0x55555555) {    fprintf(stderr,"%*s**Location: %p Type: %s Zapped pointer\n",indent,"",a,    get_name_of_type(t));    } else   #endif /* DEBUG_MALLOC */    if (((int)a) & 3) { -  fprintf(stderr,"%*s**Location: %p Type: %s Missaligned address\n",indent,"",a, +  fprintf(stderr,"%*s**Location: %p Type: %s Misaligned address\n",indent,"",a,    get_name_of_type(t));    } else {    fprintf(stderr,"%*s**Location: %p Type: %s Refs: %d\n",indent,"",a,    get_name_of_type(t),    *(INT32 *)a);    }    -  low_describe_something(a,t,indent,depth,flags); -  +    #ifdef DEBUG_MALLOC    if(!(flags & DESCRIBE_NO_DMALLOC))    debug_malloc_dump_references(a,indent+2,depth-1,flags);   #endif    -  +  low_describe_something(a,t,indent,depth,flags);    -  +     fprintf(stderr,"%*s*******************\n",indent,"");    d_flag=tmp;   }      void describe(void *x)   {    describe_something(x, attempt_to_identify(x), 0, 2, 0);   }      void debug_describe_svalue(struct svalue *s)
pike.git/src/gc.c:590: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr," has %ld references, while gc() found %ld + %ld external.\n",(long)*(INT32 *)a,(long)m->refs,(long)m->xrefs);    describe(a);    locate_references(a);    fprintf(stderr,"##### Continuing search for more bugs....\n");    fatal_after_gc="Reference to object to free in referenced object!\n";    }    }    return 0;    }    +  if (Pike_in_gc != 1) +  fatal("gc check attempted in pass %d.\n", Pike_in_gc); +     if(m->saved_refs != -1)    if(m->saved_refs != *(INT32 *)a) {    fprintf(stderr,"**Refs changed in gc() pass %d. Expected %ld, got %ld.\n",    Pike_in_gc, (long)m->saved_refs, (long)*(INT32 *)a);    describe(a);    locate_references(a);    fprintf(stderr,"##### Continuing search for more bugs....\n");    fatal_after_gc="Refs changed in gc()\n";    }    m->saved_refs = *(INT32 *)a;
pike.git/src/gc.c:800: Inside #if defined(PIKE_DEBUG)
   gc_is_referenced(a);    return 0;   }   #endif      int gc_mark(void *a)   {    struct marker *m;    m=get_marker(debug_malloc_pass(a));    + #ifdef PIKE_DEBUG +  if (Pike_in_gc != 2) +  fatal("gc mark attempted in pass %d.\n", Pike_in_gc); + #endif +     if(m->flags & GC_REFERENCED)    {    return 0;    }else{    m->flags |= GC_REFERENCED;    return 1;    }   }      #ifdef PIKE_DEBUG
pike.git/src/gc.c:863:       if(Pike_in_gc) return;    Pike_in_gc=1;       if(gc_evaluator_callback)    {    remove_callback(gc_evaluator_callback);    gc_evaluator_callback=0;    }    +  remove_objects_to_destruct_callback(); +     tmp2=num_objects;      #ifdef PIKE_DEBUG    if(t_flag) {    fprintf(stderr,"Garbage collecting ... ");   #ifdef HAVE_GETHRTIME    gcstarttime = gethrtime();   #endif    }    if(num_objects < 0)