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.69 2000/04/17 21:06:24 hubbe Exp $"); + RCSID("$Id: gc.c,v 1.70 2000/04/19 14:02:16 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:591: Inside #if defined(PIKE_DEBUG)
   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(m->saved_refs != -1) -  if(m->saved_refs != *(INT32 *)a) -  fatal("Refs changed in gc()\n"); +  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;   #endif       m->flags |= GC_CHECKED;    return add_ref(m);   }      static void init_gc(void)   {   #if 0
pike.git/src/gc.c:649: 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)   { +  void *orig_check_for=check_for;    if(!Pike_in_gc)    init_gc();       fprintf(stderr,"**Looking for references:\n");       check_for=a;       found_where=" in an array";    gc_check_all_arrays();   
pike.git/src/gc.c:684: Inside #if defined(PIKE_DEBUG) and #if defined(PIKE_DEBUG)
   extern struct mapping *builtin_constants;    if(builtin_constants)    gc_external_mark2(builtin_constants,0," &builtin_constants");    }   #endif       found_where=" in a module";    call_callback(& gc_callbacks, (void *)0);       found_where=""; -  check_for=0; +  check_for=orig_check_for;      #ifdef DEBUG_MALLOC    {    extern void dmalloc_find_references_to(void *);   #if 0    fprintf(stderr,"**DMALLOC Looking for references:\n");    dmalloc_find_references_to(a);   #endif    }   #endif
pike.git/src/gc.c:724: Inside #if defined(PIKE_DEBUG)
   INT32 xrefs=m->xrefs;    TYPE_T t=attempt_to_identify(a);    d_flag=0;       fprintf(stderr,"**Something has %ld refs, while gc() found %ld + %ld external.\n",    (long)*(INT32 *)a,    (long)refs,    (long)xrefs);       if(m->saved_refs != *(INT32 *)a) -  fprintf(stderr,"**In pass one it had %ld refs!!!\n",m->saved_refs); +  fprintf(stderr,"**In pass one it had %ld refs!!!\n",(long)m->saved_refs);       describe_something(a, t, 0,2,0);       locate_references(a);       fatal("Ref counts are wrong (has %d, found %d + %d external)\n",    *(INT32 *)a,    refs,    xrefs);    }       return m->refs < *(INT32 *)a;   }   #endif      #ifdef PIKE_DEBUG   int gc_external_mark3(void *a, void *in, char *where)   {    struct marker *m; -  +  +  if (Pike_in_gc <= 0 || Pike_in_gc >= 4) +  fatal("gc_external_mark3 called outside valid gc pass.\n"); +     if(check_for)    {    if(a==check_for)    {    char *tmp=found_where;    void *tmp2=found_in;       if(where) found_where=where;    if(in) found_in=in;