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.251 2004/04/06 15:37:55 nilsson Exp $ + || $Id: gc.c,v 1.252 2004/04/17 23:35:53 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.251 2004/04/06 15:37:55 nilsson Exp $"); + RCSID("$Id: gc.c,v 1.252 2004/04/17 23:35:53 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:781: Inside #if defined(PIKE_DEBUG)
   {    p=id_to_program(((struct object *)a)->program_id);    if(p)    fprintf(stderr,"%*s**The object is destructed but program found from id.\n",    indent,"");    else    fprintf(stderr,"%*s**The object is destructed and program not found from id.\n",    indent,"");    }    -  if (p) { +  if (((struct object *) a)->refs > 0 && p) {    size_t inh_idx, var_idx, var_count = 0;       fprintf (stderr, "%*s**Object variables:\n", indent, "");       for (inh_idx = 0; inh_idx < p->num_inherits; inh_idx++) {    struct inherit *inh = p->inherits + inh_idx;    struct program *p2 = inh->prog;       if (inh->inherit_level) {    if (inh->name) {
pike.git/src/gc.c:885: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"%*s**The program was written in C.\n",indent,"");    }       tmp = low_get_program_line_plain(p, &line, 1);    if (tmp) {    fprintf(stderr,"%*s**Location: %s:%ld\n",    indent, "", tmp, (long)line);    free (tmp);    }    -  if (!(flags & DESCRIBE_SHORT)) { +  if (!(flags & DESCRIBE_SHORT) && p->refs > 0) {    fprintf (stderr, "%*s**Identifiers:\n", indent, "");       for (id_idx = 0; id_idx < p->num_identifier_references; id_idx++) {    struct reference *id_ref = p->identifier_references + id_idx;    struct inherit *id_inh;    struct identifier *id;    const char *type;    char prot[100], descr[120];       while (next_inh < p->inherits + p->num_inherits &&
pike.git/src/gc.c:1014:    debug_dump_multiset(l);    found = 1;    }    }    if (!found)    fprintf (stderr, "%*s**Didn't find multiset for this data block!\n", indent, "");    break;    }       case T_MULTISET: +  if (((struct multiset *) a)->refs > 0)    debug_dump_multiset((struct multiset *) a);    break;       case T_ARRAY: -  +  if (((struct array *) a)->refs > 0)    debug_dump_array((struct array *)a);    break;       case T_MAPPING_DATA:    {    int found = 0;    struct mapping *m;    for(m=first_mapping;m;m=m->next)    {    if(m->data == (struct mapping_data *)a)
pike.git/src/gc.c:1040:    debug_dump_mapping((struct mapping *)m);    found = 1;    }    }    if (!found)    fprintf (stderr, "%*s**Didn't find mapping for this data block!\n", indent, "");    break;    }       case T_MAPPING: +  if (((struct mapping *) a)->refs > 0)    debug_dump_mapping((struct mapping *)a);    break;       case T_STRING:    {    struct pike_string *s=(struct pike_string *)a;    fprintf(stderr,"%*s**size_shift: %d, len: %"PRINTPTRDIFFT"d, hash: %"PRINTSIZET"x\n",    indent,"", s->len, s->size_shift, s->hval); -  if (!s->size_shift) { +  if (!s->size_shift && s->refs > 0) {    if(s->len>77)    {    fprintf(stderr,"%*s** \"%60s\"...\n",indent,"",s->str);    }else{    fprintf(stderr,"%*s** \"%s\"\n",indent,"",s->str);    }    }    break;    }       case T_PIKE_FRAME: {    struct pike_frame *f = (struct pike_frame *) a;    do { -  +  if (f->refs <= 0) break;    if (f->current_object) {    struct program *p = f->current_object->prog;    if (p) {    struct identifier *id = ID_FROM_INT(p, f->fun);    INT32 line;    struct pike_string *file;    if (IDENTIFIER_IS_PIKE_FUNCTION(id->identifier_flags) &&    id->func.offset >= 0 &&    (file = get_line(p->program + id->func.offset, p, &line))) {    fprintf(stderr, "%*s**Function %s at %s:%ld\n",