pike.git / src / main.c

version» Context lines:

pike.git/src/main.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: main.c,v 1.203 2004/09/27 21:37:13 mast Exp $ + || $Id: main.c,v 1.204 2004/09/30 11:57:53 mast Exp $   */      #include "global.h" - RCSID("$Id: main.c,v 1.203 2004/09/27 21:37:13 mast Exp $"); + RCSID("$Id: main.c,v 1.204 2004/09/30 11:57:53 mast Exp $");   #include "fdlib.h"   #include "backend.h"   #include "module.h"   #include "object.h"   #include "language.h"   #include "lex.h"   #include "pike_types.h"   #include "builtin_functions.h"   #include "array.h"   #include "stralloc.h"
pike.git/src/main.c:1032:    is_static = 1; \    if (x->refs != m->refs + is_static) { \    if (!leak_found) { \    fputs ("Leak(s) found at exit:\n", stderr); \    leak_found = 1; \    } \    fprintf (stderr, NAME " got %d unaccounted references: ", \    x->refs - (m->refs + is_static)); \    print_short_svalue (stderr, (union anything *) &x, T_TYPE); \    fputc ('\n', stderr); \ +  DO_IF_DMALLOC (debug_malloc_dump_references (x, 0, 1, 0)); \    } \    } \    } \    } while (0)       REPORT_LINKED_LIST_LEAKS (array, first_array, STATIC_ARRAYS, T_ARRAY, "Array");    REPORT_LINKED_LIST_LEAKS (multiset, first_multiset, {}, T_MULTISET, "Multiset");    REPORT_LINKED_LIST_LEAKS (mapping, first_mapping, {}, T_MAPPING, "Mapping");    REPORT_LINKED_LIST_LEAKS (program, first_program, {}, T_PROGRAM, "Program");    REPORT_LINKED_LIST_LEAKS (object, first_object, {}, T_OBJECT, "Object");      #undef REPORT_LINKED_LIST_LEAKS       /* Just remove the extra external refs reported above and do    * another gc so that we don't report the blocks again in the low    * level dmalloc reports. */      #define ZAP_LINKED_LIST_LEAKS(TYPE, START, STATICS) do { \ -  struct TYPE *x; \ -  for (x = START; x; x = x->next) { \ +  struct TYPE *x, *next; \ +  for (x = START; x; x = next) { \    struct marker *m = find_marker (x); \ -  +  next = x->next; \    if (m) { \    int is_static = 0; \    static const struct TYPE *statics[] = STATICS; \    ptrdiff_t i; /* Use signed type to avoid warnings from gcc. */ \ -  +  INT32 refs; \    for (i = 0; i < (ptrdiff_t) NELEM (statics); i++) \    if (x == statics[i]) \    is_static = 1; \ -  while (x->refs > m->refs + is_static) { \ +  refs = x->refs; \ +  while (refs > m->refs + is_static) { \    DO_IF_DEBUG (m->flags |= GC_CLEANUP_FREED); \    PIKE_CONCAT(free_, TYPE) (x); \ -  +  refs--; \    } \    } \    } \    } while (0)       ZAP_LINKED_LIST_LEAKS (array, first_array, STATIC_ARRAYS);    ZAP_LINKED_LIST_LEAKS (multiset, first_multiset, {});    ZAP_LINKED_LIST_LEAKS (mapping, first_mapping, {});    ZAP_LINKED_LIST_LEAKS (program, first_program, {});    ZAP_LINKED_LIST_LEAKS (object, first_object, {});