[sr-dev] git:master: Makefile.defs: added MEMMNG to allow selection of memory manager

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 26 14:16:33 CET 2012


Module: sip-router
Branch: master
Commit: 15a0b9c23e4b4f829bbb88f73e8042371f3f38a2
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=15a0b9c23e4b4f829bbb88f73e8042371f3f38a2

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Nov 26 13:42:07 2012 +0100

Makefile.defs: added MEMMNG to allow selection of memory manager

- MEMMNG=0 => fast malloc is used (f_malloc)
- MEMMNG=1 => quick malloc is used (q_malloc)
- MEMDBG is used now to set the debug mode for each of the managers
	- 0 - no debug info
	- 1 - debug info enabled

---

 Makefile.defs |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/Makefile.defs b/Makefile.defs
index c3d5e54..0a48248 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -164,9 +164,13 @@ PATCHLEVEL = 4
 SUBLEVEL =  0
 EXTRAVERSION = -dev5
 
+# memory manager switcher
+# 0 - f_malloc (fast malloc)
+# 1 - q_malloc (quick malloc)
+MEMMNG ?= 0
 # memory debugger switcher
-# 0 - off (release mode)
-# 1 - on (devel mode)
+# 0 - off (no-debug mode)
+# 1 - on (debug mode)
 MEMDBG ?= 0
 
 SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
@@ -712,13 +716,22 @@ C_DEFS= $(extra_defs) \
 # use make mode=debug all instead. Anyway no by default ser is  compiled w/ 
 # debugging symbols in all cases (-g). --andrei
 
-ifeq ($(MEMDBG), 1)
-	C_DEFS+= -DDBG_QM_MALLOC
+# set memory manager and its debug mode
+ifeq ($(MEMMNG), 1)
+#	use q_malloc
+ifeq 	($(MEMDBG), 1)
+		C_DEFS+= -DDBG_QM_MALLOC
+endif
 	C_DEFS+= -DMEM_JOIN_FREE
 else
+#	use f_malloc
 	C_DEFS+= -DF_MALLOC
+ifeq 	($(MEMDBG), 1)
+		C_DEFS+= -DDBG_F_MALLOC
+endif
 	C_DEFS+= -DMEM_JOIN_FREE
 endif
+
 ifneq ($(PKG_MEM_SIZE),)
 	C_DEFS+= -DPKG_MEM_SIZE=$(PKG_MEM_SIZE)
 endif




More information about the sr-dev mailing list