pike.git / src / gc.c

version» Context lines:

pike.git/src/gc.c:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: gc.c,v 1.224 2003/08/20 12:00:03 grubba Exp $ + || $Id: gc.c,v 1.225 2003/08/20 16:43:57 mast Exp $   */      #include "global.h"      struct callback *gc_evaluator_callback=0;      #include "array.h"   #include "multiset.h"   #include "mapping.h"   #include "object.h"
pike.git/src/gc.c:26:   #include "interpret.h"   #include "bignum.h"   #include "pike_threadlib.h"      #include "gc.h"   #include "main.h"   #include <math.h>      #include "block_alloc.h"    - RCSID("$Id: gc.c,v 1.224 2003/08/20 12:00:03 grubba Exp $"); + RCSID("$Id: gc.c,v 1.225 2003/08/20 16:43:57 mast Exp $");      int gc_enabled = 1;      /* These defaults are only guesses and hardly tested at all. Please improve. */   double gc_garbage_ratio_low = 0.2;   double gc_time_ratio = 0.05;   double gc_garbage_ratio_high = 0.5;      /* This slowness factor approximately corresponds to the average over    * the last ten gc rounds. (0.9 == 1 - 1/10) */
pike.git/src/gc.c:255:   int gc_in_cycle_check = 0;   static unsigned delayed_freed, weak_freed, checked, marked, cycle_checked, live_ref;   static unsigned max_gc_frames, num_gc_frames = 0, live_rec, frame_rot;   static unsigned gc_extra_refs = 0;      static unsigned max_tot_gc_frames = 0;   static unsigned tot_cycle_checked = 0, tot_live_rec = 0, tot_frame_rot = 0;      static int gc_is_watching = 0;    - int attempt_to_identify(void *something, void **inblock) + TYPE_T attempt_to_identify(void *something, void **inblock)   { -  +  size_t i;    struct array *a;    struct object *o;    struct program *p;    struct mapping *m;    struct multiset *mu; -  +  struct pike_type *t; +  struct callable *c;       if (inblock) *inblock = 0;       a=&empty_array;    do    {    if(a==(struct array *)something) return T_ARRAY;    a=a->next;    }while(a!=&empty_array);   
pike.git/src/gc.c:304:    if(mu==(struct multiset *)something)    return T_MULTISET;   #ifdef PIKE_NEW_MULTISETS    else if (mu->msd == (struct multiset_data *) something)    return T_MULTISET_DATA;   #endif       if(safe_debug_findstring((struct pike_string *)something))    return T_STRING;    +  for (i = 0; i < pike_type_hash_size; i++) +  for (t = pike_type_hash[i]; t; t = t->next) +  if (t == (struct pike_type *) something) +  return T_TYPE; +  +  for (c = first_callable; c; c = c->next) +  if (c == (struct callable *) something) +  return T_STRUCT_CALLABLE; +     return PIKE_T_UNKNOWN;   }      void *check_for =0;   static char *found_where="";   static void *found_in=0;   static int found_in_type=0;   void *gc_svalue_location=0;   char *fatal_after_gc=0;   
pike.git/src/gc.c:844: Inside #if defined(PIKE_DEBUG)
   if (o)    fprintf(stderr,"%*s**The object is on objects_to_destruct.\n",indent,"");    }       if(!p)    {    fprintf(stderr,"%*s**The object is destructed.\n",indent,"");    p=id_to_program(((struct object *)a)->program_id);    }    if (p) { -  fprintf(stderr,"%*s**Describing program of object:\n",indent,""); +  fprintf(stderr,"%*s**Describing program %p of object:\n",indent,"", p);   #ifdef DEBUG_MALLOC    if ((int) p == 0x55555555)    fprintf(stderr, "%*s**Zapped program pointer.\n", indent, "");    else   #endif    low_describe_something(p, T_PROGRAM, indent, depth, flags, 0);    }       if(p &&    (p->flags & PROGRAM_USES_PARENT) &&
pike.git/src/gc.c:2888:    n += gc_touch_all_multisets();    n += gc_touch_all_mappings();    n += gc_touch_all_programs();    n += gc_touch_all_objects();    /* gc_touch_all_strings(); */    if (n != (unsigned) num_objects)    Pike_fatal("Object count wrong after gc; expected %d, got %d.\n", num_objects, n);    GC_VERBOSE_DO(fprintf(stderr, "| posttouch: %u things\n", n));    }   #ifdef PIKE_DEBUG -  if (gc_extra_refs) +  if (gc_extra_refs) { +  size_t e; +  struct marker *m; +  fprintf (stderr, "Lost track of %d extra refs to things in gc.\n" +  "Searching for marker(s) with extra refs:\n", gc_extra_refs); +  for (e = 0; e < marker_hash_table_size; e++) +  while ((m = marker_hash_table[e])) +  if (m->flags & GC_GOT_EXTRA_REF) { +  fprintf (stderr, "========================================\n" +  "Found marker with extra ref: "); +  describe_marker (m); +  fprintf (stderr, "Describing the thing pointed to:\n"); +  describe (m->data); +  } +  fprintf (stderr, "========================================\n" +  "Done searching for marker(s) with extra refs.\n");    Pike_fatal("Lost track of %d extra refs to things in gc.\n", gc_extra_refs); -  +  }    if(fatal_after_gc) Pike_fatal("%s", fatal_after_gc);   #endif       Pike_in_gc=0;    exit_gc();       /* Calculate the next alloc_threshold. */    {    double multiplier, new_threshold;    cpu_time_t last_non_gc_time, last_gc_time;