pike.git / src / module.c

version» Context lines:

pike.git/src/module.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: module.c,v 1.52 2008/04/14 10:14:40 grubba Exp $ + || $Id: module.c,v 1.53 2008/06/02 21:50:55 mast Exp $   */      #include "global.h"   #include "module.h"   #include "pike_macros.h"   #include "pike_error.h"   #include "builtin_functions.h"   #include "main.h"   #include "svalue.h"   #include "interpret.h"
pike.git/src/module.c:280:    /* 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. */      #ifdef PIKE_DEBUG    /* If we stumble on the real refs whose refcounts we're zapping,    * we should try to handle it gracefully, and log all frees. */    gc_external_refs_zapped = 1;   #endif    - #if 1 -  /* It can be a good idea to disable this to leave the blocks -  * around to be reported by an external memchecker like valgrind. -  * Ideally we should only free the svalues inside these things but -  * leave the blocks themselves. */ + #ifdef VALGRIND_DO_LEAK_CHECK +  /* Let valgrind print a leak report before we free the leaked +  * blocks. Ideally we should only free the svalues inside them +  * below and make the report afterwards. */ +  VALGRIND_DO_LEAK_CHECK; + #endif      #define ZAP_LINKED_LIST_LEAKS(TYPE, START, STATICS) do { \    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 NULL}; \    ptrdiff_t i; /* Use signed type to avoid warnings from gcc. */ \
pike.git/src/module.c:323:       {    size_t index;    for (index = 0; index < pike_type_hash_size; index++) {    ZAP_LINKED_LIST_LEAKS(pike_type, pike_type_hash[index], NOTHING);    }    }      #undef ZAP_LINKED_LIST_LEAKS    - #endif /* 1 */ -  +     do_gc (NULL, 1);       gc_keep_markers = 0;    exit_gc();    }       destruct_objects_to_destruct_cb();       /* Now there are no arrays/objects/programs/anything left. */