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.238 2004/01/13 09:24:18 grubba Exp $ + || $Id: gc.c,v 1.239 2004/03/15 14:07:39 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.238 2004/01/13 09:24:18 grubba Exp $"); + RCSID("$Id: gc.c,v 1.239 2004/03/15 14:07:39 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:76:    * still intact during this destruct pass, so it's entirely possible    * to save them by adding external references to them. However, it's    * not possible for live objects to save themselves or other live    * objects; all live objects that didn't have external references at    * the start of the gc pass will be destructed regardless of added    * references.    *    * Things that have only weak external references at the start of the    * gc pass will be freed. That's done before the live object destruct    * pass. Internal weak references are however still intact. +  * +  * Note: Keep the doc for lfun::destroy up-to-date with the above.    */      /* #define GC_VERBOSE */   /* #define GC_CYCLE_DEBUG */      /* #define GC_STACK_DEBUG */      #if defined(GC_VERBOSE) && !defined(PIKE_DEBUG)   #undef GC_VERBOSE   #endif
pike.git/src/gc.c:607:    struct pike_frame *f = (struct pike_frame *) descblock;    if (f->locals) { /* Paranoia. */    ptrdiff_t pos = (struct svalue *) location - f->locals;    if (pos >= 0) {    if (pos < f->num_args)    fprintf (stderr, "%*s **In argument %"PRINTPTRDIFFT"d\n",    indent, "", pos);    else    fprintf (stderr, "%*s **At position %"PRINTPTRDIFFT"d among locals\n",    indent, "", pos - f->num_args); +  /* Don't describe current_object for the frame. */ +  flags |= DESCRIBE_SHORT;    }    }    break;    }    }       if(memblock && depth>0)    describe_something(memblock,type,indent+2,depth-1,flags,inblock);      #ifdef DEBUG_MALLOC
pike.git/src/gc.c:710: Inside #if defined(PIKE_DEBUG)
     #ifdef PIKE_DEBUG      static void gdb_gc_stop_here(void *a, int weak)   {    fprintf(stderr,"***One %sref found%s. ",    weak ? "weak " : "",    gc_found_place ? gc_found_place : "");    if (gc_found_in) {    if (gc_svalue_location) -  describe_location(gc_found_in , gc_found_in_type, gc_svalue_location,0,1,0); +  describe_location(gc_found_in , gc_found_in_type, gc_svalue_location,0,1, +  DESCRIBE_SHORT);    else {    fputc('\n', stderr); -  describe_something(gc_found_in, gc_found_in_type, 0, 0, 0, 0); +  describe_something(gc_found_in, gc_found_in_type, 0, 0, DESCRIBE_SHORT, 0);    }    }    else    fputc('\n', stderr);    fprintf(stderr,"----------end------------\n");   }      void low_describe_something(void *a,    int t,    int indent,
pike.git/src/gc.c:1097:    id->func.offset >= 0 &&    (file = get_line(p->program + id->func.offset, p, &line))) {    fprintf(stderr, "%*s**Function %s at %s:%ld\n",    indent, "", id->name->str, file->str, (long) line);    free_string(file);    }    else    fprintf(stderr, "%*s**Function %s at unknown location.\n",    indent, "", id->name->str);    } +  if (!(flags & DESCRIBE_SHORT)) {    fprintf(stderr, "%*s**Describing the current object:\n", indent, "");    describe_something(f->current_object, T_OBJECT, indent+2, depth, flags, 0);    } -  +  }    else    fprintf(stderr, "%*s**No current object.\n", indent, "");    if ((f = f->scope))    fprintf(stderr, "%*s**Moving on to outer scope frame %p:\n", indent, "", f);    } while (f);    break;    }       default:    fprintf(stderr, "%*s**Cannot describe block of unknown type %d\n",