From d18ea641fdc84abd1b3426c381edf05aff6baaf9 Mon Sep 17 00:00:00 2001 From: Martin Stjernholm <mast@lysator.liu.se> Date: Mon, 19 Jul 2010 17:49:25 +0200 Subject: [PATCH] Made some statically allocated structs known to dmalloc. Rev: src/module.c:1.61 Rev: src/multiset.c:1.122 --- src/module.c | 14 +++++++++++++- src/multiset.c | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/module.c b/src/module.c index 0d2aca00c7..2660ed3f38 100644 --- a/src/module.c +++ b/src/module.c @@ -2,7 +2,7 @@ || 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.60 2010/05/31 13:59:05 grubba Exp $ +|| $Id: module.c,v 1.61 2010/07/19 15:49:24 mast Exp $ */ #include "global.h" @@ -58,6 +58,18 @@ static void init_builtin_modules(void) void init_facetgroup(void); #endif +#ifdef DEBUG_MALLOC + /* Make some statically allocated structs known to dmalloc. These + * will still show up in the DO_PIKE_CLEANUP leak report if they + * leak, in spite of dmalloc_accept_leak. */ + dmalloc_register (&empty_array, sizeof (empty_array), + DMALLOC_LOCATION()); + dmalloc_accept_leak (&empty_array); + dmalloc_register (&weak_empty_array, sizeof (weak_empty_array), + DMALLOC_LOCATION()); + dmalloc_accept_leak (&weak_empty_array); +#endif + TRACE((stderr, "Init cpp...\n")); init_cpp(); diff --git a/src/multiset.c b/src/multiset.c index fe867c945a..6d28e68d93 100644 --- a/src/multiset.c +++ b/src/multiset.c @@ -2,7 +2,7 @@ || 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: multiset.c,v 1.121 2010/07/11 19:12:02 mast Exp $ +|| $Id: multiset.c,v 1.122 2010/07/19 15:49:25 mast Exp $ */ #include "global.h" @@ -4389,6 +4389,17 @@ void init_multiset() test.i.ind.type); #undef msnode_check #endif + +#ifdef DEBUG_MALLOC + /* Make some statically allocated structs known to dmalloc. */ + dmalloc_register (&empty_ind_msd, sizeof (empty_ind_msd), + DMALLOC_LOCATION()); + dmalloc_accept_leak (&empty_ind_msd); + dmalloc_register (&empty_indval_msd, sizeof (empty_indval_msd), + DMALLOC_LOCATION()); + dmalloc_accept_leak (&empty_indval_msd); +#endif + init_multiset_blocks(); } -- GitLab