pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:101:    m->marked=a;    m->refs=0;    m->flags=0;    m->next=hash[hashval];    hash[hashval]=m;       return m;   }      #ifdef DEBUG - static void *check_for =0; + void *gc_check_for =0;      static void gdb_gc_stop_here(void *a)   {    fprintf(stderr,"One ref found.\n");   }   #endif      INT32 gc_check(void *a)   {   #ifdef DEBUG -  if(check_for) +  if(gc_check_for)    { -  if(check_for == a) +  if(gc_check_for == a)    {    gdb_gc_stop_here(a); -  +  return -2;    } -  return 0; +  return -1;    }   #endif    return getmark(a)->refs++;   }      int gc_is_referenced(void *a)   {    struct marker *m;    m=getmark(a);   #ifdef DEBUG    if(m->refs > *(INT32 *)a)    { -  check_for=a; +  gc_check_for=a;    -  +  fprintf(stderr,"Too many ref counts found %d > %d (%lx)\n",m->refs, *(INT32 *)a, (long)a); +  +  fprintf(stderr,"Checking arrays\n");    gc_check_all_arrays(); -  +  fprintf(stderr,"Checking multisets\n");    gc_check_all_multisets(); -  +  fprintf(stderr,"Checking mappings\n");    gc_check_all_mappings(); -  +  fprintf(stderr,"Checking programs\n");    gc_check_all_programs(); -  +  fprintf(stderr,"Checking objects\n");    gc_check_all_objects(); -  +  fprintf(stderr,"Checking callbacks\n");    call_callback(& gc_callbacks, (void *)0);    -  check_for=0; +  gc_check_for=0;    fatal("Ref counts are totally wrong!!!\n");    }   #endif    return m->refs < *(INT32 *)a;   }      int gc_mark(void *a)   {    struct marker *m;    m=getmark(a);