Переглянути джерело

- separate memdbg log level which controls the memory/malloc related
debug messages (to see them ser must be compiled with malloc
debuging: -DDBG_QM_MALLOC or -DDBG_FM_MALLOC and
memdbg must be <= debug ). By default is set to L_DBG.
E.g.: setting memdbg=100 in ser.cfg will make sure that you'll
never see a malloc debug message.
Note: memdbg is different from memlog, memlog is the log level used
for malloc statistics (printed on exit or on SIGUSR1).

- default log level switched to 0: this means that in the absence
of -d* commandline parameters or of the debug=no in ser.cfg, only
errors and other critical messages will be logged (no warnings,
info, notice or dbg).

Andrei Pelinescu-Onciul 19 роки тому
батько
коміт
58d0d1b5b6
12 змінених файлів з 93 додано та 27 видалено
  1. 1 1
      Makefile.defs
  2. 5 0
      NEWS
  3. 2 0
      cfg.lex
  4. 3 0
      cfg.y
  5. 1 0
      dprint.h
  6. 2 0
      globals.h
  7. 3 1
      main.c
  8. 13 11
      mem/f_malloc.c
  9. 3 2
      mem/mem.h
  10. 45 0
      mem/memdbg.h
  11. 13 11
      mem/q_malloc.c
  12. 2 1
      mem/shm_mem.c

+ 1 - 1
Makefile.defs

@@ -66,7 +66,7 @@ MAIN_NAME=ser
 VERSION = 0
 VERSION = 0
 PATCHLEVEL = 10
 PATCHLEVEL = 10
 SUBLEVEL =   99
 SUBLEVEL =   99
-EXTRAVERSION = -dev36
+EXTRAVERSION = -dev37
 
 
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 			$(SUBLEVEL) )
 			$(SUBLEVEL) )

+ 5 - 0
NEWS

@@ -49,6 +49,11 @@ modules:
               Vias a.s.o) and not on the original message
               Vias a.s.o) and not on the original message
  
  
 core:
 core:
+ - default log level switched to 0 (only messages < L_WARN will be printed
+   by default)
+ - separate memdbg log level which controls the memory/malloc related
+   debug messages (to see them ser must be compiled with malloc debuging:
+     -DDBG_QM_MALLOC or -DDBG_FM_MALLOC and memdbg must be <= debug )
  - added named routes: names can be used instead of numbers in all the
  - added named routes: names can be used instead of numbers in all the
    route commads or route declarations. route(number) is equivalent to
    route commads or route declarations. route(number) is equivalent to
    route("number").
    route("number").

+ 2 - 0
cfg.lex

@@ -229,6 +229,7 @@ CHILDREN children
 CHECK_VIA	check_via
 CHECK_VIA	check_via
 SYN_BRANCH syn_branch
 SYN_BRANCH syn_branch
 MEMLOG		"memlog"|"mem_log"
 MEMLOG		"memlog"|"mem_log"
+MEMDBG		"memdbg"|"mem_dbg"
 SIP_WARNING sip_warning
 SIP_WARNING sip_warning
 SERVER_SIGNATURE server_signature
 SERVER_SIGNATURE server_signature
 REPLY_TO_VIA reply_to_via
 REPLY_TO_VIA reply_to_via
@@ -418,6 +419,7 @@ EAT_ABLE	[\ \t\b\r]
 <INITIAL>{CHECK_VIA}	{ count(); yylval.strval=yytext; return CHECK_VIA; }
 <INITIAL>{CHECK_VIA}	{ count(); yylval.strval=yytext; return CHECK_VIA; }
 <INITIAL>{SYN_BRANCH}	{ count(); yylval.strval=yytext; return SYN_BRANCH; }
 <INITIAL>{SYN_BRANCH}	{ count(); yylval.strval=yytext; return SYN_BRANCH; }
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
+<INITIAL>{MEMDBG}	{ count(); yylval.strval=yytext; return MEMDBG; }
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
 <INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }
 <INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }

+ 3 - 0
cfg.y

@@ -236,6 +236,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %token CHECK_VIA
 %token CHECK_VIA
 %token SYN_BRANCH
 %token SYN_BRANCH
 %token MEMLOG
 %token MEMLOG
+%token MEMDBG
 %token SIP_WARNING
 %token SIP_WARNING
 %token SERVER_SIGNATURE
 %token SERVER_SIGNATURE
 %token REPLY_TO_VIA
 %token REPLY_TO_VIA
@@ -504,6 +505,8 @@ assign_stm:
 	| SYN_BRANCH EQUAL error { yyerror("boolean value expected"); }
 	| SYN_BRANCH EQUAL error { yyerror("boolean value expected"); }
 	| MEMLOG EQUAL NUMBER { memlog=$3; }
 	| MEMLOG EQUAL NUMBER { memlog=$3; }
 	| MEMLOG EQUAL error { yyerror("int value expected"); }
 	| MEMLOG EQUAL error { yyerror("int value expected"); }
+	| MEMDBG EQUAL NUMBER { memdbg=$3; }
+	| MEMDBG EQUAL error { yyerror("int value expected"); }
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
 	| SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
 	| SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
 	| USER EQUAL STRING     { user=$3; }
 	| USER EQUAL STRING     { user=$3; }

+ 1 - 0
dprint.h

@@ -36,6 +36,7 @@
 #define L_ALERT -3
 #define L_ALERT -3
 #define L_CRIT  -2
 #define L_CRIT  -2
 #define L_ERR   -1
 #define L_ERR   -1
+#define L_DEFAULT 0
 #define L_WARN   1
 #define L_WARN   1
 #define L_NOTICE 2
 #define L_NOTICE 2
 #define L_INFO   3
 #define L_INFO   3

+ 2 - 0
globals.h

@@ -139,6 +139,8 @@ extern int is_main;
 
 
 /* debugging level for dumping memory status */
 /* debugging level for dumping memory status */
 extern int memlog;
 extern int memlog;
+/* debugging level for malloc debugging messages */
+extern int memdbg;
 
 
 /* debugging level for timer debugging (see -DTIMER_DEBUG) */
 /* debugging level for timer debugging (see -DTIMER_DEBUG) */
 extern int timerlog;
 extern int timerlog;

+ 3 - 1
main.c

@@ -242,7 +242,7 @@ int tls_disable = 0; /* 1 if tls is disabled */
 struct process_table *pt=0;		/*array with children pids, 0= main proc,
 struct process_table *pt=0;		/*array with children pids, 0= main proc,
 									alloc'ed in shared mem if possible*/
 									alloc'ed in shared mem if possible*/
 int sig_flag = 0;              /* last signal received */
 int sig_flag = 0;              /* last signal received */
-int debug = L_NOTICE;
+int debug = L_DEFAULT; /* print only msg. < L_WARN */
 int dont_fork = 0;
 int dont_fork = 0;
 int log_stderr = 0;
 int log_stderr = 0;
 /* log facility (see syslog(3)) */
 /* log facility (see syslog(3)) */
@@ -254,6 +254,8 @@ int check_via =  0;
 int syn_branch = 1;
 int syn_branch = 1;
 /* debugging level for memory stats */
 /* debugging level for memory stats */
 int memlog = L_DBG;
 int memlog = L_DBG;
+/* debugging level for the malloc debug messages */
+int memdbg = L_DBG;
 /* debugging level for timer debugging */
 /* debugging level for timer debugging */
 int timerlog = L_WARN;
 int timerlog = L_WARN;
 /* should replies include extensive warnings? by default yes,
 /* should replies include extensive warnings? by default yes,

+ 13 - 11
mem/f_malloc.c

@@ -37,6 +37,7 @@
  *  2005-12-12  fixed realloc shrink real_used accounting (andrei)
  *  2005-12-12  fixed realloc shrink real_used accounting (andrei)
  *              fixed initial size (andrei)
  *              fixed initial size (andrei)
  *  2006-02-03  fixed realloc out of mem. free bug (andrei)
  *  2006-02-03  fixed realloc out of mem. free bug (andrei)
+ *  2006-04-07  s/DBG/MDBG (andrei)
  */
  */
 
 
 
 
@@ -48,6 +49,7 @@
 #include "f_malloc.h"
 #include "f_malloc.h"
 #include "../dprint.h"
 #include "../dprint.h"
 #include "../globals.h"
 #include "../globals.h"
+#include "memdbg.h"
 
 
 
 
 /*useful macros*/
 /*useful macros*/
@@ -256,7 +258,7 @@ void* fm_malloc(struct fm_block* qm, unsigned long size)
 	int hash;
 	int hash;
 	
 	
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
+	MDBG("fm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
 			line);
 			line);
 #endif
 #endif
 	/*size must be a multiple of 8*/
 	/*size must be a multiple of 8*/
@@ -292,7 +294,7 @@ found:
 	frag->func=func;
 	frag->func=func;
 	frag->line=line;
 	frag->line=line;
 	frag->check=ST_CHECK_PATTERN;
 	frag->check=ST_CHECK_PATTERN;
-	DBG("fm_malloc(%p, %lu) returns address %p \n", qm, size,
+	MDBG("fm_malloc(%p, %lu) returns address %p \n", qm, size,
 		(char*)frag+sizeof(struct fm_frag));
 		(char*)frag+sizeof(struct fm_frag));
 #else
 #else
 	fm_split_frag(qm, frag, size);
 	fm_split_frag(qm, frag, size);
@@ -320,7 +322,7 @@ void fm_free(struct fm_block* qm, void* p)
 	unsigned long size;
 	unsigned long size;
 
 
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_free(%p, %p), called from %s: %s(%d)\n", qm, p, file, func, line);
+	MDBG("fm_free(%p, %p), called from %s: %s(%d)\n", qm, p, file, func, line);
 	if (p>(void*)qm->last_frag || p<(void*)qm->first_frag){
 	if (p>(void*)qm->last_frag || p<(void*)qm->first_frag){
 		LOG(L_CRIT, "BUG: fm_free: bad pointer %p (out of memory block!) - "
 		LOG(L_CRIT, "BUG: fm_free: bad pointer %p (out of memory block!) - "
 				"aborting\n", p);
 				"aborting\n", p);
@@ -333,8 +335,8 @@ void fm_free(struct fm_block* qm, void* p)
 	}
 	}
 	f=(struct fm_frag*) ((char*)p-sizeof(struct fm_frag));
 	f=(struct fm_frag*) ((char*)p-sizeof(struct fm_frag));
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_free: freeing block alloc'ed from %s: %s(%ld)\n", f->file, f->func,
-			f->line);
+	MDBG("fm_free: freeing block alloc'ed from %s: %s(%ld)\n",
+			f->file, f->func, f->line);
 #endif
 #endif
 	size=f->size;
 	size=f->size;
 #if defined(DBG_F_MALLOC) || defined(MALLOC_STATS)
 #if defined(DBG_F_MALLOC) || defined(MALLOC_STATS)
@@ -366,7 +368,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	int hash;
 	int hash;
 	
 	
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
+	MDBG("fm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
 			file, func, line);
 			file, func, line);
 	if ((p)&&(p>(void*)qm->last_frag || p<(void*)qm->first_frag)){
 	if ((p)&&(p>(void*)qm->last_frag || p<(void*)qm->first_frag)){
 		LOG(L_CRIT, "BUG: fm_free: bad pointer %p (out of memory block!) - "
 		LOG(L_CRIT, "BUG: fm_free: bad pointer %p (out of memory block!) - "
@@ -391,7 +393,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 #endif
 #endif
 	f=(struct fm_frag*) ((char*)p-sizeof(struct fm_frag));
 	f=(struct fm_frag*) ((char*)p-sizeof(struct fm_frag));
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_realloc: realloc'ing frag %p alloc'ed from %s: %s(%ld)\n",
+	MDBG("fm_realloc: realloc'ing frag %p alloc'ed from %s: %s(%ld)\n",
 			f, f->file, f->func, f->line);
 			f, f->file, f->func, f->line);
 #endif
 #endif
 	size=ROUNDUP(size);
 	size=ROUNDUP(size);
@@ -399,7 +401,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	if (f->size > size){
 	if (f->size > size){
 		/* shrink */
 		/* shrink */
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-		DBG("fm_realloc: shrinking from %lu to %lu\n", f->size, size);
+		MDBG("fm_realloc: shrinking from %lu to %lu\n", f->size, size);
 		fm_split_frag(qm, f, size, file, "frag. from fm_realloc", line);
 		fm_split_frag(qm, f, size, file, "frag. from fm_realloc", line);
 #else
 #else
 		fm_split_frag(qm, f, size);
 		fm_split_frag(qm, f, size);
@@ -411,7 +413,7 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	}else if (f->size<size){
 	}else if (f->size<size){
 		/* grow */
 		/* grow */
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-		DBG("fm_realloc: growing from %lu to %lu\n", f->size, size);
+		MDBG("fm_realloc: growing from %lu to %lu\n", f->size, size);
 #endif
 #endif
 		diff=size-f->size;
 		diff=size-f->size;
 		n=FRAG_NEXT(f);
 		n=FRAG_NEXT(f);
@@ -471,12 +473,12 @@ void* fm_realloc(struct fm_block* qm, void* p, unsigned long size)
 	}else{
 	}else{
 		/* do nothing */
 		/* do nothing */
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-		DBG("fm_realloc: doing nothing, same size: %lu - %lu\n", 
+		MDBG("fm_realloc: doing nothing, same size: %lu - %lu\n", 
 				f->size, size);
 				f->size, size);
 #endif
 #endif
 	}
 	}
 #ifdef DBG_F_MALLOC
 #ifdef DBG_F_MALLOC
-	DBG("fm_realloc: returning %p\n", p);
+	MDBG("fm_realloc: returning %p\n", p);
 #endif
 #endif
 	return p;
 	return p;
 }
 }

+ 3 - 2
mem/mem.h

@@ -121,11 +121,12 @@
 #	define pkg_status()  shm_status()
 #	define pkg_status()  shm_status()
 #else
 #else
 #	include <stdlib.h>
 #	include <stdlib.h>
+#	include "memdbg.h"
 #	define pkg_malloc(s) \
 #	define pkg_malloc(s) \
 	(  { void *v; v=malloc((s)); \
 	(  { void *v; v=malloc((s)); \
-	   DBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
+	   MDBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
 	   v; } )
 	   v; } )
-#	define pkg_free(p)  do{ DBG("free %p\n", (p)); free((p)); }while(0);
+#	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
 #	define pkg_status()
 #	define pkg_status()
 #endif
 #endif
 
 

+ 45 - 0
mem/memdbg.h

@@ -0,0 +1,45 @@
+/*
+ * $Id$
+ *
+ * Copyright (C) 2006 iptelorg GmbH
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* malloc debug messages
+ * History:
+ * --------
+ *  2006-04-07             created by andrei
+ */
+
+
+#ifndef _memdbg_h
+#define _memdbg_h
+
+extern int memdbg;
+
+#ifdef NO_DEBUG
+	#ifdef __SUNPRO_C
+		#define MDBG(...)
+	#else
+		#define MDBG(fmt, args...)
+	#endif
+#else /* NO_DEBUG */
+	#ifdef __SUNPRO_C
+		#define MDBG(...) LOG(memdbg, __VA_ARGS__)
+	#else
+		#define MDBG(fmt, args...) LOG(memdbg, fmt,  ## args)
+	#endif
+#endif /* NO_DEBUG */
+
+
+#endif

+ 13 - 11
mem/q_malloc.c

@@ -38,6 +38,7 @@
  *  2005-12-12  fixed realloc shrink real_used & used accounting;
  *  2005-12-12  fixed realloc shrink real_used & used accounting;
  *              fixed initial size (andrei)
  *              fixed initial size (andrei)
  *  2006-02-03  fixed realloc out of mem. free bug (andrei)
  *  2006-02-03  fixed realloc out of mem. free bug (andrei)
+ *  2006-04-07  s/DBG/MDBG (andrei)
  */
  */
 
 
 
 
@@ -50,6 +51,7 @@
 #include "q_malloc.h"
 #include "q_malloc.h"
 #include "../dprint.h"
 #include "../dprint.h"
 #include "../globals.h"
 #include "../globals.h"
+#include "memdbg.h"
 
 
 
 
 /*useful macros*/
 /*useful macros*/
@@ -364,7 +366,7 @@ void* qm_malloc(struct qm_block* qm, unsigned long size)
 	unsigned int list_cntr;
 	unsigned int list_cntr;
 
 
 	list_cntr = 0;
 	list_cntr = 0;
-	DBG("qm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
+	MDBG("qm_malloc(%p, %lu) called from %s: %s(%d)\n", qm, size, file, func,
 			line);
 			line);
 #endif
 #endif
 	/*size must be a multiple of 8*/
 	/*size must be a multiple of 8*/
@@ -403,7 +405,7 @@ void* qm_malloc(struct qm_block* qm, unsigned long size)
 		f->check=ST_CHECK_PATTERN;
 		f->check=ST_CHECK_PATTERN;
 		/*  FRAG_END(f)->check1=END_CHECK_PATTERN1;
 		/*  FRAG_END(f)->check1=END_CHECK_PATTERN1;
 			FRAG_END(f)->check2=END_CHECK_PATTERN2;*/
 			FRAG_END(f)->check2=END_CHECK_PATTERN2;*/
-		DBG("qm_malloc(%p, %lu) returns address %p frag. %p (size=%lu) on %d"
+		MDBG("qm_malloc(%p, %lu) returns address %p frag. %p (size=%lu) on %d"
 				" -th hit\n",
 				" -th hit\n",
 			 qm, size, (char*)f+sizeof(struct qm_frag), f, f->size, list_cntr );
 			 qm, size, (char*)f+sizeof(struct qm_frag), f, f->size, list_cntr );
 #endif
 #endif
@@ -427,7 +429,7 @@ void qm_free(struct qm_block* qm, void* p)
 	unsigned long size;
 	unsigned long size;
 
 
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-	DBG("qm_free(%p, %p), called from %s: %s(%d)\n", qm, p, file, func, line);
+	MDBG("qm_free(%p, %p), called from %s: %s(%d)\n", qm, p, file, func, line);
 	if (p>(void*)qm->last_frag_end || p<(void*)qm->first_frag){
 	if (p>(void*)qm->last_frag_end || p<(void*)qm->first_frag){
 		LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "
 		LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "
 				"aborting\n", p);
 				"aborting\n", p);
@@ -448,7 +450,7 @@ void qm_free(struct qm_block* qm, void* p)
 				f->file, f->func, f->line);
 				f->file, f->func, f->line);
 		abort();
 		abort();
 	}
 	}
-	DBG("qm_free: freeing frag. %p alloc'ed from %s: %s(%ld)\n",
+	MDBG("qm_free: freeing frag. %p alloc'ed from %s: %s(%ld)\n",
 			f, f->file, f->func, f->line);
 			f, f->file, f->func, f->line);
 #endif
 #endif
 	size=f->size;
 	size=f->size;
@@ -513,7 +515,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	
 	
 	
 	
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-	DBG("qm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
+	MDBG("qm_realloc(%p, %p, %lu) called from %s: %s(%d)\n", qm, p, size,
 			file, func, line);
 			file, func, line);
 	if ((p)&&(p>(void*)qm->last_frag_end || p<(void*)qm->first_frag)){
 	if ((p)&&(p>(void*)qm->last_frag_end || p<(void*)qm->first_frag)){
 		LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "
 		LOG(L_CRIT, "BUG: qm_free: bad pointer %p (out of memory block!) - "
@@ -540,7 +542,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	f=(struct qm_frag*) ((char*)p-sizeof(struct qm_frag));
 	f=(struct qm_frag*) ((char*)p-sizeof(struct qm_frag));
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
 	qm_debug_frag(qm, f);
 	qm_debug_frag(qm, f);
-	DBG("qm_realloc: realloc'ing frag %p alloc'ed from %s: %s(%ld)\n",
+	MDBG("qm_realloc: realloc'ing frag %p alloc'ed from %s: %s(%ld)\n",
 			f, f->file, f->func, f->line);
 			f, f->file, f->func, f->line);
 	if (f->u.is_free){
 	if (f->u.is_free){
 		LOG(L_CRIT, "BUG:qm_realloc: trying to realloc an already freed "
 		LOG(L_CRIT, "BUG:qm_realloc: trying to realloc an already freed "
@@ -554,9 +556,9 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 		orig_size=f->size;
 		orig_size=f->size;
 		/* shrink */
 		/* shrink */
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-		DBG("qm_realloc: shrinking from %lu to %lu\n", f->size, size);
+		MDBG("qm_realloc: shrinking from %lu to %lu\n", f->size, size);
 		if(split_frag(qm, f, size, file, "fragm. from qm_realloc", line)!=0){
 		if(split_frag(qm, f, size, file, "fragm. from qm_realloc", line)!=0){
-		DBG("qm_realloc : shrinked successful\n");
+		MDBG("qm_realloc : shrinked successful\n");
 #else
 #else
 		if(split_frag(qm, f, size)!=0){
 		if(split_frag(qm, f, size)!=0){
 #endif
 #endif
@@ -568,7 +570,7 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	}else if (f->size < size){
 	}else if (f->size < size){
 		/* grow */
 		/* grow */
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-		DBG("qm_realloc: growing from %lu to %lu\n", f->size, size);
+		MDBG("qm_realloc: growing from %lu to %lu\n", f->size, size);
 #endif
 #endif
 			orig_size=f->size;
 			orig_size=f->size;
 			diff=size-f->size;
 			diff=size-f->size;
@@ -614,12 +616,12 @@ void* qm_realloc(struct qm_block* qm, void* p, unsigned long size)
 	}else{
 	}else{
 		/* do nothing */
 		/* do nothing */
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-		DBG("qm_realloc: doing nothing, same size: %lu - %lu\n",
+		MDBG("qm_realloc: doing nothing, same size: %lu - %lu\n",
 				f->size, size);
 				f->size, size);
 #endif
 #endif
 	}
 	}
 #ifdef DBG_QM_MALLOC
 #ifdef DBG_QM_MALLOC
-	DBG("qm_realloc: returning %p\n", p);
+	MDBG("qm_realloc: returning %p\n", p);
 #endif
 #endif
 	return p;
 	return p;
 }
 }

+ 2 - 1
mem/shm_mem.c

@@ -42,6 +42,7 @@
 #include "shm_mem.h"
 #include "shm_mem.h"
 #include "../config.h"
 #include "../config.h"
 #include "../globals.h"
 #include "../globals.h"
+#include "memdbg.h"
 
 
 #ifdef  SHM_MMAP
 #ifdef  SHM_MMAP
 
 
@@ -107,7 +108,7 @@ void* _shm_resize( void* p , unsigned int s)
 #	ifdef DBG_QM_MALLOC
 #	ifdef DBG_QM_MALLOC
 #	ifdef VQ_MALLOC
 #	ifdef VQ_MALLOC
 	f=(struct  vqm_frag*) ((char*)p-sizeof(struct vqm_frag));
 	f=(struct  vqm_frag*) ((char*)p-sizeof(struct vqm_frag));
-	DBG("_shm_resize(%p, %d), called from %s: %s(%d)\n",  
+	MDBG("_shm_resize(%p, %d), called from %s: %s(%d)\n",  
 		p, s, file, func, line);
 		p, s, file, func, line);
 	VQM_DEBUG_FRAG(shm_block, f);
 	VQM_DEBUG_FRAG(shm_block, f);
 	if (p>(void *)shm_block->core_end || p<(void*)shm_block->init_core){
 	if (p>(void *)shm_block->core_end || p<(void*)shm_block->init_core){