Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,204 +0,0 @@
1
-/*
2
- * Copyright (C) 2001-2003 FhG Fokus
3
- *
4
- * This file is part of Kamailio, a free SIP server.
5
- *
6
- * Permission to use, copy, modify, and distribute this software for any
7
- * purpose with or without fee is hereby granted, provided that the above
8
- * copyright notice and this permission notice appear in all copies.
9
- *
10
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
- */
18
-
19
-/**
20
- * \defgroup mem Kamailio memory manager
21
- * \brief  Kamailio internal memory manager
22
- * 
23
- * Kamailio internal memory manager for private (per process) and shared
24
- * memory pools. It provides several different strategies for the memory
25
- * management, like really fast, with extended debugging and also plain system
26
- * memory management.
27
- */
28
-
29
-/**
30
- * \file
31
- * \brief Main definitions for memory manager
32
- * 
33
- * \brief Main definitions for memory manager, like malloc, free and realloc
34
- * \ingroup mem
35
- */
36
-
37
-
38
-#ifndef mem_h
39
-#define mem_h
40
-#include "../config.h"
41
-#include "../dprint.h"
42
-
43
-#include "pkg.h"
44
-
45
-#if 0
46
-/* fix debug defines, DBG_F_MALLOC <=> DBG_QM_MALLOC */
47
-#ifdef F_MALLOC
48
-	#ifdef DBG_F_MALLOC
49
-		#ifndef DBG_QM_MALLOC
50
-			#define DBG_QM_MALLOC
51
-		#endif
52
-	#elif defined(DBG_QM_MALLOC)
53
-		#define DBG_F_MALLOC
54
-	#endif
55
-#elif defined TLSF_MALLOC
56
-	#ifdef DBG_TLSF_MALLOC
57
-		#ifndef DBG_QM_MALLOC
58
-			#define DBG_QM_MALLOC
59
-		#endif
60
-	#elif defined(DBG_QM_MALLOC)
61
-		#define DBG_TLSF_MALLOC
62
-	#endif
63
-#endif
64
-
65
-#ifdef PKG_MALLOC
66
-#	ifdef F_MALLOC
67
-#		include "f_malloc.h"
68
-		extern struct fm_block* mem_block;
69
-#	elif defined DL_MALLOC
70
-#		include "dl_malloc.h"
71
-#	elif defined TLSF_MALLOC
72
-#		include "tlsf.h"
73
-		extern tlsf_t mem_block;
74
-#   else
75
-#		include "q_malloc.h"
76
-		extern struct qm_block* mem_block;
77
-#	endif
78
-
79
-	extern char* mem_pool;
80
-
81
-
82
-#	ifdef DBG_QM_MALLOC
83
-
84
-#	include "src_loc.h" /* src location macros: _SRC_* */
85
-#		ifdef F_MALLOC
86
-#			define pkg_malloc(s) fm_malloc(mem_block, (s), _SRC_LOC_, \
87
-				_SRC_FUNCTION_, _SRC_LINE_)
88
-#			define pkg_free(p)   fm_free(mem_block, (p), _SRC_LOC_,  \
89
-				_SRC_FUNCTION_, _SRC_LINE_)
90
-#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s), \
91
-					_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
92
-#		elif defined TLSF_MALLOC
93
-#			define pkg_malloc(s) tlsf_malloc(mem_block, (s), _SRC_LOC_, \
94
-				_SRC_FUNCTION_, _SRC_LINE_)
95
-#			define pkg_free(p)   tlsf_free(mem_block, (p), _SRC_LOC_,  \
96
-				_SRC_FUNCTION_, _SRC_LINE_)
97
-#			define pkg_realloc(p, s) tlsf_realloc(mem_block, (p), (s), \
98
-					_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
99
-#		else
100
-#			define pkg_malloc(s) qm_malloc(mem_block, (s),_SRC_LOC_, \
101
-				_SRC_FUNCTION_, _SRC_LINE_)
102
-#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s), \
103
-				_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
104
-#			define pkg_free(p)   qm_free(mem_block, (p), _SRC_LOC_,  \
105
-				_SRC_FUNCTION_, _SRC_LINE_)
106
-#		endif
107
-#	else
108
-#		ifdef F_MALLOC
109
-#			define pkg_malloc(s) fm_malloc(mem_block, (s))
110
-#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s))
111
-#			define pkg_free(p)   fm_free(mem_block, (p))
112
-#		elif defined DL_MALLOC
113
-#			define pkg_malloc(s) dlmalloc((s))
114
-#			define pkg_realloc(p, s) dlrealloc((p), (s))
115
-#			define pkg_free(p)   dlfree((p))
116
-#		elif defined TLSF_MALLOC
117
-#			define pkg_malloc(s) tlsf_malloc(mem_block, (s))
118
-#			define pkg_realloc(p, s) tlsf_realloc(mem_block, (p), (s))
119
-#			define pkg_free(p)   tlsf_free(mem_block, (p))
120
-#		else
121
-#			define pkg_malloc(s) qm_malloc(mem_block, (s))
122
-#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s))
123
-#			define pkg_free(p)   qm_free(mem_block, (p))
124
-#		endif
125
-#	endif
126
-#	ifdef F_MALLOC
127
-#		define pkg_status()    fm_status(mem_block)
128
-#		define pkg_info(mi)    fm_info(mem_block, mi)
129
-#		define pkg_available() fm_available(mem_block)
130
-#		define pkg_sums()      fm_sums(mem_block)
131
-#	elif defined DL_MALLOC
132
-#		define pkg_status()  0
133
-#		define pkg_info(mi)  0
134
-#		define pkg_available()  0
135
-#		define pkg_sums()  0
136
-#	elif defined TLSF_MALLOC
137
-#		define pkg_status()  tlsf_status(mem_block)
138
-#		define pkg_info(mi)  tlsf_meminfo(mem_block, (mi))
139
-#		define pkg_available()  tlsf_available(mem_block)
140
-#		define pkg_sums()  tlsf_sums(mem_block)
141
-#	else
142
-#		define pkg_status()    qm_status(mem_block)
143
-#		define pkg_info(mi)    qm_info(mem_block, mi)
144
-#		define pkg_available() qm_available(mem_block)
145
-#		define pkg_sums()      qm_sums(mem_block)
146
-#	endif
147
-#elif defined(SHM_MEM) && defined(USE_SHM_MEM)
148
-#	include "shm_mem.h"
149
-#	define pkg_malloc(s)	shm_malloc((s))
150
-#	define pkg_relloc(p, s)	shm_malloc((p), (s))
151
-#	define pkg_free(p)		shm_free((p))
152
-#	define pkg_status()		shm_status()
153
-#	define pkg_sums()		shm_sums()
154
-#else
155
-#	include <stdlib.h>
156
-#	include "memdbg.h"
157
-#	ifdef DBG_SYS_MALLOC
158
-#	define pkg_malloc(s) \
159
-	(  { void *____v123; ____v123=malloc((s)); \
160
-	   MDBG("malloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
161
-	   ____v123; } )
162
-#	define pkg_realloc(p, s) \
163
-	(  { void *____v123; ____v123=realloc(p, s); \
164
-	   MDBG("realloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
165
-	    ____v123; } )
166
-#	define pkg_free(p)  do{ MDBG("free %p (%s:%d)\n", (p), __FILE__, __LINE__); free((p)); }while(0)
167
-#	else
168
-#	define pkg_malloc(s)		malloc((s))
169
-#	define pkg_realloc(p, s)	realloc((p), (s))
170
-#	define pkg_free(p)			free((p))
171
-#	endif
172
-#	define pkg_status()
173
-#	define pkg_sums()
174
-#endif
175
-
176
-/**
177
- * \brief Initialize private memory pool
178
- * \return 0 if the memory allocation was successful, -1 otherwise
179
- */
180
-int init_pkg_mallocs(void);
181
-
182
-/**
183
- * \brief Destroy private memory pool
184
- */
185
-void destroy_pkg_mallocs(void);
186
-
187
-/**
188
- * \brief Initialize shared memory pool
189
- * \param force_alloc Force allocation of memory, e.g. initialize complete block with zero
190
- * \return 0 if the memory allocation was successful, -1 otherwise
191
- */
192
-int init_shm_mallocs(int force_alloc);
193
-#endif
194
-
195
-/** generic logging helper for allocation errors in private memory pool/ system */
196
-#ifdef SYSTEM_MALLOC
197
-#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from system")
198
-#else
199
-#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from available pool")
200
-#endif
201
-/** generic logging helper for allocation errors in shared memory pool */
202
-#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from available pool")
203
-
204
-#endif
Browse code

mem Change SIP-router to Kamailio

Olle E. Johansson authored on 03/04/2016 18:05:12
Showing 1 changed files
... ...
@@ -17,10 +17,10 @@
17 17
  */
18 18
 
19 19
 /**
20
- * \defgroup mem SIP-router memory manager
21
- * \brief  SIP-router internal memory manager
20
+ * \defgroup mem Kamailio memory manager
21
+ * \brief  Kamailio internal memory manager
22 22
  * 
23
- * SIP-router internal memory manager for private (per process) and shared
23
+ * Kamailio internal memory manager for private (per process) and shared
24 24
  * memory pools. It provides several different strategies for the memory
25 25
  * management, like really fast, with extended debugging and also plain system
26 26
  * memory management.
Browse code

mem: old pkg management disabled

Daniel-Constantin Mierla authored on 14/09/2015 07:23:22
Showing 1 changed files
... ...
@@ -40,6 +40,9 @@
40 40
 #include "../config.h"
41 41
 #include "../dprint.h"
42 42
 
43
+#include "pkg.h"
44
+
45
+#if 0
43 46
 /* fix debug defines, DBG_F_MALLOC <=> DBG_QM_MALLOC */
44 47
 #ifdef F_MALLOC
45 48
 	#ifdef DBG_F_MALLOC
... ...
@@ -187,6 +190,7 @@ void destroy_pkg_mallocs(void);
187 190
  * \return 0 if the memory allocation was successful, -1 otherwise
188 191
  */
189 192
 int init_shm_mallocs(int force_alloc);
193
+#endif
190 194
 
191 195
 /** generic logging helper for allocation errors in private memory pool/ system */
192 196
 #ifdef SYSTEM_MALLOC
Browse code

mem: TLSF memory summary and sums implementation

TLSF now has a debug mode, that will dump every memory block when xxx_status()
is called, and a summary of still allocated blocks when xxx_sums() is called.

configure build with

make MEMDBG=1 MEMMNG=2 cfg

to enable maximum debuging informations (source location of mallocs and frees)

Camille Oudot authored on 19/05/2015 17:58:57
Showing 1 changed files
... ...
@@ -49,6 +49,14 @@
49 49
 	#elif defined(DBG_QM_MALLOC)
50 50
 		#define DBG_F_MALLOC
51 51
 	#endif
52
+#elif defined TLSF_MALLOC
53
+	#ifdef DBG_TLSF_MALLOC
54
+		#ifndef DBG_QM_MALLOC
55
+			#define DBG_QM_MALLOC
56
+		#endif
57
+	#elif defined(DBG_QM_MALLOC)
58
+		#define DBG_TLSF_MALLOC
59
+	#endif
52 60
 #endif
53 61
 
54 62
 #ifdef PKG_MALLOC
... ...
@@ -78,6 +86,13 @@
78 86
 				_SRC_FUNCTION_, _SRC_LINE_)
79 87
 #			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s), \
80 88
 					_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
89
+#		elif defined TLSF_MALLOC
90
+#			define pkg_malloc(s) tlsf_malloc(mem_block, (s), _SRC_LOC_, \
91
+				_SRC_FUNCTION_, _SRC_LINE_)
92
+#			define pkg_free(p)   tlsf_free(mem_block, (p), _SRC_LOC_,  \
93
+				_SRC_FUNCTION_, _SRC_LINE_)
94
+#			define pkg_realloc(p, s) tlsf_realloc(mem_block, (p), (s), \
95
+					_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
81 96
 #		else
82 97
 #			define pkg_malloc(s) qm_malloc(mem_block, (s),_SRC_LOC_, \
83 98
 				_SRC_FUNCTION_, _SRC_LINE_)
... ...
@@ -116,10 +131,10 @@
116 131
 #		define pkg_available()  0
117 132
 #		define pkg_sums()  0
118 133
 #	elif defined TLSF_MALLOC
119
-#		define pkg_status()  ((void) 0)
134
+#		define pkg_status()  tlsf_status(mem_block)
120 135
 #		define pkg_info(mi)  tlsf_meminfo(mem_block, (mi))
121
-#		define pkg_available()  ((void) 0)
122
-#		define pkg_sums()  ((void) 0)
136
+#		define pkg_available()  tlsf_available(mem_block)
137
+#		define pkg_sums()  tlsf_sums(mem_block)
123 138
 #	else
124 139
 #		define pkg_status()    qm_status(mem_block)
125 140
 #		define pkg_info(mi)    qm_info(mem_block, mi)
Browse code

mem: TLSF integration for pkg memory

Camille Oudot authored on 23/04/2015 15:25:29
Showing 1 changed files
... ...
@@ -57,6 +57,9 @@
57 57
 		extern struct fm_block* mem_block;
58 58
 #	elif defined DL_MALLOC
59 59
 #		include "dl_malloc.h"
60
+#	elif defined TLSF_MALLOC
61
+#		include "tlsf.h"
62
+		extern tlsf_t mem_block;
60 63
 #   else
61 64
 #		include "q_malloc.h"
62 65
 		extern struct qm_block* mem_block;
... ...
@@ -92,6 +95,10 @@
92 95
 #			define pkg_malloc(s) dlmalloc((s))
93 96
 #			define pkg_realloc(p, s) dlrealloc((p), (s))
94 97
 #			define pkg_free(p)   dlfree((p))
98
+#		elif defined TLSF_MALLOC
99
+#			define pkg_malloc(s) tlsf_malloc(mem_block, (s))
100
+#			define pkg_realloc(p, s) tlsf_realloc(mem_block, (p), (s))
101
+#			define pkg_free(p)   tlsf_free(mem_block, (p))
95 102
 #		else
96 103
 #			define pkg_malloc(s) qm_malloc(mem_block, (s))
97 104
 #			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s))
... ...
@@ -108,6 +115,11 @@
108 115
 #		define pkg_info(mi)  0
109 116
 #		define pkg_available()  0
110 117
 #		define pkg_sums()  0
118
+#	elif defined TLSF_MALLOC
119
+#		define pkg_status()  ((void) 0)
120
+#		define pkg_info(mi)  tlsf_meminfo(mem_block, (mi))
121
+#		define pkg_available()  ((void) 0)
122
+#		define pkg_sums()  ((void) 0)
111 123
 #	else
112 124
 #		define pkg_status()    qm_status(mem_block)
113 125
 #		define pkg_info(mi)    qm_info(mem_block, mi)
Browse code

mem Remove SVN ID, remove history

Olle E. Johansson authored on 25/02/2015 08:12:38
Showing 1 changed files
... ...
@@ -1,7 +1,7 @@
1 1
 /*
2 2
  * Copyright (C) 2001-2003 FhG Fokus
3 3
  *
4
- * This file is part of sip-router, a free SIP server.
4
+ * This file is part of Kamailio, a free SIP server.
5 5
  *
6 6
  * Permission to use, copy, modify, and distribute this software for any
7 7
  * purpose with or without fee is hereby granted, provided that the above
... ...
@@ -16,16 +16,6 @@
16 16
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 17
  */
18 18
 
19
-/*
20
- * History:
21
- * --------
22
- *  2003-03-10  __FUNCTION__ is a gcc-ism, defined it to "" for sun cc
23
- *               (andrei)
24
- *  2003-03-07  split init_malloc into init_pkg_mallocs & init_shm_mallocs 
25
- *               (andrei)
26
- *  2007-02-23   added pkg_info() and pkg_available() (andrei)
27
- */
28
-
29 19
 /**
30 20
  * \defgroup mem SIP-router memory manager
31 21
  * \brief  SIP-router internal memory manager
Browse code

mem: remove trailing ; to allow using as single instruction in conditinal blocks

- this is for system malloc with extra debug for private memory

Daniel-Constantin Mierla authored on 21/04/2014 15:40:27
Showing 1 changed files
... ...
@@ -143,7 +143,7 @@
143 143
 	(  { void *____v123; ____v123=realloc(p, s); \
144 144
 	   MDBG("realloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
145 145
 	    ____v123; } )
146
-#	define pkg_free(p)  do{ MDBG("free %p (%s:%d)\n", (p), __FILE__, __LINE__); free((p)); }while(0);
146
+#	define pkg_free(p)  do{ MDBG("free %p (%s:%d)\n", (p), __FILE__, __LINE__); free((p)); }while(0)
147 147
 #	else
148 148
 #	define pkg_malloc(s)		malloc((s))
149 149
 #	define pkg_realloc(p, s)	realloc((p), (s))
Browse code

mem: DBG_SYS_MALLOC can be set to get verbose mem ops with system allocator

- PKG_MEMORY has to be undefined in Makefile.defs

Daniel-Constantin Mierla authored on 21/04/2014 12:08:10
Showing 1 changed files
... ...
@@ -126,22 +126,29 @@
126 126
 #	endif
127 127
 #elif defined(SHM_MEM) && defined(USE_SHM_MEM)
128 128
 #	include "shm_mem.h"
129
-#	define pkg_malloc(s) shm_malloc((s))
130
-#	define pkg_free(p)   shm_free((p))
131
-#	define pkg_status()  shm_status()
132
-#	define pkg_sums()    shm_sums()
129
+#	define pkg_malloc(s)	shm_malloc((s))
130
+#	define pkg_relloc(p, s)	shm_malloc((p), (s))
131
+#	define pkg_free(p)		shm_free((p))
132
+#	define pkg_status()		shm_status()
133
+#	define pkg_sums()		shm_sums()
133 134
 #else
134 135
 #	include <stdlib.h>
135 136
 #	include "memdbg.h"
137
+#	ifdef DBG_SYS_MALLOC
136 138
 #	define pkg_malloc(s) \
137 139
 	(  { void *____v123; ____v123=malloc((s)); \
138
-	   MDBG("malloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
140
+	   MDBG("malloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
139 141
 	   ____v123; } )
140 142
 #	define pkg_realloc(p, s) \
141 143
 	(  { void *____v123; ____v123=realloc(p, s); \
142
-	   MDBG("realloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
144
+	   MDBG("realloc %p size %lu end %p (%s:%d)\n", ____v123, (unsigned long)(s), (char*)____v123+(s), __FILE__, __LINE__);\
143 145
 	    ____v123; } )
144
-#	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
146
+#	define pkg_free(p)  do{ MDBG("free %p (%s:%d)\n", (p), __FILE__, __LINE__); free((p)); }while(0);
147
+#	else
148
+#	define pkg_malloc(s)		malloc((s))
149
+#	define pkg_realloc(p, s)	realloc((p), (s))
150
+#	define pkg_free(p)			free((p))
151
+#	endif
145 152
 #	define pkg_status()
146 153
 #	define pkg_sums()
147 154
 #endif
Browse code

mem: small def./decl. fix for a bunch of internal functions, use void argument

Henning Westerholt authored on 13/07/2011 22:16:38
Showing 1 changed files
... ...
@@ -150,12 +150,12 @@
150 150
  * \brief Initialize private memory pool
151 151
  * \return 0 if the memory allocation was successful, -1 otherwise
152 152
  */
153
-int init_pkg_mallocs();
153
+int init_pkg_mallocs(void);
154 154
 
155 155
 /**
156 156
  * \brief Destroy private memory pool
157 157
  */
158
-void destroy_pkg_mallocs();
158
+void destroy_pkg_mallocs(void);
159 159
 
160 160
 /**
161 161
  * \brief Initialize shared memory pool
Browse code

mem: initial doxygen documentation for MM, small whitespace changes

Henning Westerholt authored on 13/07/2011 22:11:48
Showing 1 changed files
... ...
@@ -1,8 +1,4 @@
1
-/* $Id$
2
- *
3
- * memory related stuff (malloc & friends)
4
- * 
5
- *
1
+/*
6 2
  * Copyright (C) 2001-2003 FhG Fokus
7 3
  *
8 4
  * This file is part of sip-router, a free SIP server.
... ...
@@ -19,6 +15,7 @@
19 15
  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 16
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 17
  */
18
+
22 19
 /*
23 20
  * History:
24 21
  * --------
... ...
@@ -29,6 +26,23 @@
29 26
  *  2007-02-23   added pkg_info() and pkg_available() (andrei)
30 27
  */
31 28
 
29
+/**
30
+ * \defgroup mem SIP-router memory manager
31
+ * \brief  SIP-router internal memory manager
32
+ * 
33
+ * SIP-router internal memory manager for private (per process) and shared
34
+ * memory pools. It provides several different strategies for the memory
35
+ * management, like really fast, with extended debugging and also plain system
36
+ * memory management.
37
+ */
38
+
39
+/**
40
+ * \file
41
+ * \brief Main definitions for memory manager
42
+ * 
43
+ * \brief Main definitions for memory manager, like malloc, free and realloc
44
+ * \ingroup mem
45
+ */
32 46
 
33 47
 
34 48
 #ifndef mem_h
... ...
@@ -132,17 +146,31 @@
132 146
 #	define pkg_sums()
133 147
 #endif
134 148
 
149
+/**
150
+ * \brief Initialize private memory pool
151
+ * \return 0 if the memory allocation was successful, -1 otherwise
152
+ */
135 153
 int init_pkg_mallocs();
154
+
155
+/**
156
+ * \brief Destroy private memory pool
157
+ */
136 158
 void destroy_pkg_mallocs();
159
+
160
+/**
161
+ * \brief Initialize shared memory pool
162
+ * \param force_alloc Force allocation of memory, e.g. initialize complete block with zero
163
+ * \return 0 if the memory allocation was successful, -1 otherwise
164
+ */
137 165
 int init_shm_mallocs(int force_alloc);
138 166
 
139
-/*! generic logging helper for allocation errors in private memory pool/ system */
167
+/** generic logging helper for allocation errors in private memory pool/ system */
140 168
 #ifdef SYSTEM_MALLOC
141 169
 #define PKG_MEM_ERROR LM_ERR("could not allocate private memory from system")
142 170
 #else
143 171
 #define PKG_MEM_ERROR LM_ERR("could not allocate private memory from available pool")
144 172
 #endif
145
-/*! generic logging helper for allocation errors in shared memory pool */
173
+/** generic logging helper for allocation errors in shared memory pool */
146 174
 #define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from available pool")
147 175
 
148 176
 #endif
Browse code

core: pkg mem size configurable form the cmd line

The pkg mem size used can be configured by using the "-M"
parameter on the command line, e.g.:
ser -M 8 -f test.cfg # start ser with 8mb of pkg memory
The default remains 4Mb.

Andrei Pelinescu-Onciul authored on 12/04/2011 19:54:07
Showing 1 changed files
... ...
@@ -58,7 +58,7 @@
58 58
 		extern struct qm_block* mem_block;
59 59
 #	endif
60 60
 
61
-	extern char mem_pool[PKG_MEM_POOL_SIZE];
61
+	extern char* mem_pool;
62 62
 
63 63
 
64 64
 #	ifdef DBG_QM_MALLOC
... ...
@@ -133,6 +133,7 @@
133 133
 #endif
134 134
 
135 135
 int init_pkg_mallocs();
136
+void destroy_pkg_mallocs();
136 137
 int init_shm_mallocs(int force_alloc);
137 138
 
138 139
 /*! generic logging helper for allocation errors in private memory pool/ system */
Browse code

mem: include the module name in the debugging info

- use <module_name: file> when recording the filename information
for debugging (DBQ_QM_MALLOC defined)
- added a new file that should define in a portable way the
various location info (file, function, a.s.o.)

Andrei Pelinescu-Onciul authored on 08/10/2009 09:33:25
Showing 1 changed files
... ...
@@ -62,23 +62,22 @@
62 62
 
63 63
 
64 64
 #	ifdef DBG_QM_MALLOC
65
-#ifdef __SUNPRO_C
66
-		#define __FUNCTION__ ""  /* gcc specific */
67
-#endif
65
+
66
+#	include "src_loc.h" /* src location macros: _SRC_* */
68 67
 #		ifdef F_MALLOC
69
-#			define pkg_malloc(s) fm_malloc(mem_block, (s),__FILE__, \
70
-				__FUNCTION__, __LINE__)
71
-#			define pkg_free(p)   fm_free(mem_block, (p), __FILE__,  \
72
-				__FUNCTION__, __LINE__)
73
-#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s),__FILE__, \
74
-				__FUNCTION__, __LINE__)
68
+#			define pkg_malloc(s) fm_malloc(mem_block, (s), _SRC_LOC_, \
69
+				_SRC_FUNCTION_, _SRC_LINE_)
70
+#			define pkg_free(p)   fm_free(mem_block, (p), _SRC_LOC_,  \
71
+				_SRC_FUNCTION_, _SRC_LINE_)
72
+#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s), \
73
+					_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
75 74
 #		else
76
-#			define pkg_malloc(s) qm_malloc(mem_block, (s),__FILE__, \
77
-				__FUNCTION__, __LINE__)
78
-#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s),__FILE__, \
79
-				__FUNCTION__, __LINE__)
80
-#			define pkg_free(p)   qm_free(mem_block, (p), __FILE__,  \
81
-				__FUNCTION__, __LINE__)
75
+#			define pkg_malloc(s) qm_malloc(mem_block, (s),_SRC_LOC_, \
76
+				_SRC_FUNCTION_, _SRC_LINE_)
77
+#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s), \
78
+				_SRC_LOC_, _SRC_FUNCTION_, _SRC_LINE_)
79
+#			define pkg_free(p)   qm_free(mem_block, (p), _SRC_LOC_,  \
80
+				_SRC_FUNCTION_, _SRC_LINE_)
82 81
 #		endif
83 82
 #	else
84 83
 #		ifdef F_MALLOC
Browse code

core: mem dbg options updates + cleanups

- memlog and memdbg can now be changed at runtime
- double define warning fix for fm_malloc (when compiled with -DF_MALLOC)
- nicer qm_status() & qm_sums() output
- BSD licence for mem/*

Andrei Pelinescu-Onciul authored on 29/09/2009 13:25:50
Showing 1 changed files
... ...
@@ -5,26 +5,19 @@
5 5
  *
6 6
  * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
8
- * This file is part of ser, a free SIP server.
8
+ * This file is part of sip-router, a free SIP server.
9 9
  *
10
- * ser is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License as published by
12
- * the Free Software Foundation; either version 2 of the License, or
13
- * (at your option) any later version
10
+ * Permission to use, copy, modify, and distribute this software for any
11
+ * purpose with or without fee is hereby granted, provided that the above
12
+ * copyright notice and this permission notice appear in all copies.
14 13
  *
15
- * For a license to use the ser software under conditions
16
- * other than those described here, or to purchase support for this
17
- * software, please contact iptel.org by e-mail at the following addresses:
18
- *    info@iptel.org
19
- *
20
- * ser is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License 
26
- * along with this program; if not, write to the Free Software 
27
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
14
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
28 21
  */
29 22
 /*
30 23
  * History:
Browse code

core: remove VQ_MALLOC memory manager

attached patch removes the VQ_MALLOC memory manager from the
sip-router core. As discussed some time ago, this memory manager
doesn't provide a realloc implementation, and is thus not really
usable for the modules, as some of them needs this. We removed
this in kamailio in the last year, so far nobody missed it.

Signed-off-by: Andrei Pelinescu-Onciul <andrei@iptel.org>

Henning Westerholt authored on 17/03/2009 12:24:42 • Andrei Pelinescu-Onciul committed on 29/09/2009 17:03:41
Showing 1 changed files
... ...
@@ -55,10 +55,7 @@
55 55
 #endif
56 56
 
57 57
 #ifdef PKG_MALLOC
58
-#	ifdef VQ_MALLOC
59
-#		include "vq_malloc.h"
60
-		extern struct vqm_block* mem_block;
61
-#	elif defined F_MALLOC
58
+#	ifdef F_MALLOC
62 59
 #		include "f_malloc.h"
63 60
 		extern struct fm_block* mem_block;
64 61
 #	elif defined DL_MALLOC
... ...
@@ -75,13 +72,7 @@
75 72
 #ifdef __SUNPRO_C
76 73
 		#define __FUNCTION__ ""  /* gcc specific */
77 74
 #endif
78
-#		ifdef VQ_MALLOC
79
-#			define pkg_malloc(s) vqm_malloc(mem_block, (s),__FILE__, \
80
-				__FUNCTION__, __LINE__)
81
-#			define pkg_free(p)   vqm_free(mem_block, (p), __FILE__,  \
82
-				__FUNCTION__, __LINE__)
83
-#			warn "no proper realloc implementation, use another mem. alloc"
84
-#		elif defined F_MALLOC
75
+#		ifdef F_MALLOC
85 76
 #			define pkg_malloc(s) fm_malloc(mem_block, (s),__FILE__, \
86 77
 				__FUNCTION__, __LINE__)
87 78
 #			define pkg_free(p)   fm_free(mem_block, (p), __FILE__,  \
... ...
@@ -97,10 +88,7 @@
97 88
 				__FUNCTION__, __LINE__)
98 89
 #		endif
99 90
 #	else
100
-#		ifdef VQ_MALLOC
101
-#			define pkg_malloc(s) vqm_malloc(mem_block, (s))
102
-#			define pkg_free(p)   vqm_free(mem_block, (p))
103
-#		elif defined F_MALLOC
91
+#		ifdef F_MALLOC
104 92
 #			define pkg_malloc(s) fm_malloc(mem_block, (s))
105 93
 #			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s))
106 94
 #			define pkg_free(p)   fm_free(mem_block, (p))
... ...
@@ -114,9 +102,7 @@
114 102
 #			define pkg_free(p)   qm_free(mem_block, (p))
115 103
 #		endif
116 104
 #	endif
117
-#	ifdef VQ_MALLOC
118
-#		define pkg_status()  vqm_status(mem_block)
119
-#	elif defined F_MALLOC
105
+#	ifdef F_MALLOC
120 106
 #		define pkg_status()    fm_status(mem_block)
121 107
 #		define pkg_info(mi)    fm_info(mem_block, mi)
122 108
 #		define pkg_available() fm_available(mem_block)
Browse code

mem: summarize in-use memory on exit

Additional qm_sums and fm_sums as extension to qm_status/fm_status, with
summarized values per allocation source.
Slightly modified SER-224 patch version (no locking, sr changes --andrei).

Closes SER-224.

Signed-off-by: Andrei Pelinescu-Onciul <andrei@iptel.org>

Dragos Vingarzan authored on 28/09/2009 20:01:17 • Andrei Pelinescu-Onciul committed on 29/09/2009 17:03:40
Showing 1 changed files
... ...
@@ -120,20 +120,24 @@
120 120
 #		define pkg_status()    fm_status(mem_block)
121 121
 #		define pkg_info(mi)    fm_info(mem_block, mi)
122 122
 #		define pkg_available() fm_available(mem_block)
123
+#		define pkg_sums()      fm_sums(mem_block)
123 124
 #	elif defined DL_MALLOC
124 125
 #		define pkg_status()  0
125 126
 #		define pkg_info(mi)  0
126 127
 #		define pkg_available()  0
128
+#		define pkg_sums()  0
127 129
 #	else
128 130
 #		define pkg_status()    qm_status(mem_block)
129 131
 #		define pkg_info(mi)    qm_info(mem_block, mi)
130 132
 #		define pkg_available() qm_available(mem_block)
133
+#		define pkg_sums()      qm_sums(mem_block)
131 134
 #	endif
132 135
 #elif defined(SHM_MEM) && defined(USE_SHM_MEM)
133 136
 #	include "shm_mem.h"
134 137
 #	define pkg_malloc(s) shm_malloc((s))
135 138
 #	define pkg_free(p)   shm_free((p))
136 139
 #	define pkg_status()  shm_status()
140
+#	define pkg_sums()    shm_sums()
137 141
 #else
138 142
 #	include <stdlib.h>
139 143
 #	include "memdbg.h"
... ...
@@ -147,6 +151,7 @@
147 151
 	    ____v123; } )
148 152
 #	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
149 153
 #	define pkg_status()
154
+#	define pkg_sums()
150 155
 #endif
151 156
 
152 157
 int init_pkg_mallocs();
Browse code

add SHM_MEM_ERROR and PKG_MEM_ERROR logging macros to mem.h

Henning Westerholt authored on 21/11/2008 12:23:02
Showing 1 changed files
... ...
@@ -152,4 +152,13 @@
152 152
 int init_pkg_mallocs();
153 153
 int init_shm_mallocs(int force_alloc);
154 154
 
155
+/*! generic logging helper for allocation errors in private memory pool/ system */
156
+#ifdef SYSTEM_MALLOC
157
+#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from system")
158
+#else
159
+#define PKG_MEM_ERROR LM_ERR("could not allocate private memory from available pool")
160
+#endif
161
+/*! generic logging helper for allocation errors in shared memory pool */
162
+#define SHM_MEM_ERROR LM_ERR("could not allocate shared memory from available pool")
163
+
155 164
 #endif
Browse code

- support for pre-faulting the shm mem. pages (memset(0))

Andrei Pelinescu-Onciul authored on 07/06/2007 21:49:53
Showing 1 changed files
... ...
@@ -150,6 +150,6 @@
150 150
 #endif
151 151
 
152 152
 int init_pkg_mallocs();
153
-int init_shm_mallocs();
153
+int init_shm_mallocs(int force_alloc);
154 154
 
155 155
 #endif
Browse code

Add a new memory allocator (-DDL_MALLOC) which is based on Doug Lea's dl_malloc implementation (http://g.oswego.edu/dl/html/malloc.html). Patch has been provided by Jan Andres <jan.andres@freenet-ag.de>

Notes:
- very fast, esp. on shm_malloc() in comparison to other algorithms
- has been in production use at freenet(.de) for 6+ months
- is picky about buffer overruns (aka detects and crashes on them)
- disabled by default (set -DDL_MALLOC in Makefile.defs)
- closes SER-278

Hendrik Scholz authored on 01/06/2007 09:20:34
Showing 1 changed files
... ...
@@ -61,6 +61,8 @@
61 61
 #	elif defined F_MALLOC
62 62
 #		include "f_malloc.h"
63 63
 		extern struct fm_block* mem_block;
64
+#	elif defined DL_MALLOC
65
+#		include "dl_malloc.h"
64 66
 #   else
65 67
 #		include "q_malloc.h"
66 68
 		extern struct qm_block* mem_block;
... ...
@@ -102,6 +104,10 @@
102 104
 #			define pkg_malloc(s) fm_malloc(mem_block, (s))
103 105
 #			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s))
104 106
 #			define pkg_free(p)   fm_free(mem_block, (p))
107
+#		elif defined DL_MALLOC
108
+#			define pkg_malloc(s) dlmalloc((s))
109
+#			define pkg_realloc(p, s) dlrealloc((p), (s))
110
+#			define pkg_free(p)   dlfree((p))
105 111
 #		else
106 112
 #			define pkg_malloc(s) qm_malloc(mem_block, (s))
107 113
 #			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s))
... ...
@@ -114,6 +120,10 @@
114 120
 #		define pkg_status()    fm_status(mem_block)
115 121
 #		define pkg_info(mi)    fm_info(mem_block, mi)
116 122
 #		define pkg_available() fm_available(mem_block)
123
+#	elif defined DL_MALLOC
124
+#		define pkg_status()  0
125
+#		define pkg_info(mi)  0
126
+#		define pkg_available()  0
117 127
 #	else
118 128
 #		define pkg_status()    qm_status(mem_block)
119 129
 #		define pkg_info(mi)    qm_info(mem_block, mi)
Browse code

- added shm_available/pkg_available/{qm,fm}_available: return the ammount of free memory

Andrei Pelinescu-Onciul authored on 23/02/2007 23:20:51
Showing 1 changed files
... ...
@@ -33,6 +33,7 @@
33 33
  *               (andrei)
34 34
  *  2003-03-07  split init_malloc into init_pkg_mallocs & init_shm_mallocs 
35 35
  *               (andrei)
36
+ *  2007-02-23   added pkg_info() and pkg_available() (andrei)
36 37
  */
37 38
 
38 39
 
... ...
@@ -110,9 +111,13 @@
110 111
 #	ifdef VQ_MALLOC
111 112
 #		define pkg_status()  vqm_status(mem_block)
112 113
 #	elif defined F_MALLOC
113
-#		define pkg_status()  fm_status(mem_block)
114
+#		define pkg_status()    fm_status(mem_block)
115
+#		define pkg_info(mi)    fm_info(mem_block, mi)
116
+#		define pkg_available() fm_available(mem_block)
114 117
 #	else
115
-#		define pkg_status()  qm_status(mem_block)
118
+#		define pkg_status()    qm_status(mem_block)
119
+#		define pkg_info(mi)    qm_info(mem_block, mi)
120
+#		define pkg_available() qm_available(mem_block)
116 121
 #	endif
117 122
 #elif defined(SHM_MEM) && defined(USE_SHM_MEM)
118 123
 #	include "shm_mem.h"
Browse code

Improve system malloc support:

1. Convert size argument into unsigned long when printing out, so that
it doesn't generate compiler warning;

2. In pkg_malloc() wrapper use less generic temporary variable name to
avoid potential namespace conflicts with the modules code.

3. Provide pkg_realloc() wrapper.

Sponsored by: Sippy Software, Inc.

Maxim Sobolev authored on 02/11/2006 19:43:51
Showing 1 changed files
... ...
@@ -123,9 +123,13 @@
123 123
 #	include <stdlib.h>
124 124
 #	include "memdbg.h"
125 125
 #	define pkg_malloc(s) \
126
-	(  { void *v; v=malloc((s)); \
127
-	   MDBG("malloc %p size %d end %p\n", v, (s), (char*)v+(s));\
128
-	   v; } )
126
+	(  { void *____v123; ____v123=malloc((s)); \
127
+	   MDBG("malloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
128
+	   ____v123; } )
129
+#	define pkg_realloc(p, s) \
130
+	(  { void *____v123; ____v123=realloc(p, s); \
131
+	   MDBG("realloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
132
+	    ____v123; } )
129 133
 #	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
130 134
 #	define pkg_status()
131 135
 #endif
Browse code

- add brackets around 's' to allow pkg_malloc() to be invoked with non-atomic operands, i.e. dupl_string() in db/db_id.c

Hendrik Scholz authored on 01/11/2006 14:46:21
Showing 1 changed files
... ...
@@ -124,7 +124,7 @@
124 124
 #	include "memdbg.h"
125 125
 #	define pkg_malloc(s) \
126 126
 	(  { void *v; v=malloc((s)); \
127
-	   MDBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
127
+	   MDBG("malloc %p size %d end %p\n", v, (s), (char*)v+(s));\
128 128
 	   v; } )
129 129
 #	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
130 130
 #	define pkg_status()
Browse code

- 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 authored on 07/04/2006 14:55:27
Showing 1 changed files
... ...
@@ -121,11 +121,12 @@
121 121
 #	define pkg_status()  shm_status()
122 122
 #else
123 123
 #	include <stdlib.h>
124
+#	include "memdbg.h"
124 125
 #	define pkg_malloc(s) \
125 126
 	(  { void *v; v=malloc((s)); \
126
-	   DBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
127
+	   MDBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
127 128
 	   v; } )
128
-#	define pkg_free(p)  do{ DBG("free %p\n", (p)); free((p)); }while(0);
129
+#	define pkg_free(p)  do{ MDBG("free %p\n", (p)); free((p)); }while(0);
129 130
 #	define pkg_status()
130 131
 #endif
131 132
 
Browse code

- Spelling checked - READMEs updated

Jan Janak authored on 24/08/2004 08:58:23
Showing 1 changed files
... ...
@@ -3,7 +3,7 @@
3 3
  * memory related stuff (malloc & friends)
4 4
  * 
5 5
  *
6
- * Copyright (C) 2001-2003 Fhg Fokus
6
+ * Copyright (C) 2001-2003 FhG Fokus
7 7
  *
8 8
  * This file is part of ser, a free SIP server.
9 9
  *
Browse code

- sock_lists completely re-organized

Andrei Pelinescu-Onciul authored on 24/10/2003 20:23:58
Showing 1 changed files
... ...
@@ -123,9 +123,9 @@
123 123
 #	include <stdlib.h>
124 124
 #	define pkg_malloc(s) \
125 125
 	(  { void *v; v=malloc((s)); \
126
-	   DBG("malloc %x size %d end %x\n", v, s, (unsigned int)v+(s));\
126
+	   DBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
127 127
 	   v; } )
128
-#	define pkg_free(p)  do{ DBG("free %x\n", (p)); free((p)); }while(0);
128
+#	define pkg_free(p)  do{ DBG("free %p\n", (p)); free((p)); }while(0);
129 129
 #	define pkg_status()
130 130
 #endif
131 131
 
Browse code

- added fm_realloc (now only vm_ misses realloc) - cosmetic fixes in ip_addr (print_ip changed)

Andrei Pelinescu-Onciul authored on 06/07/2003 18:43:16
Showing 1 changed files
... ...
@@ -42,6 +42,17 @@
42 42
 #include "../config.h"
43 43
 #include "../dprint.h"
44 44
 
45
+/* fix debug defines, DBG_F_MALLOC <=> DBG_QM_MALLOC */
46
+#ifdef F_MALLOC
47
+	#ifdef DBG_F_MALLOC
48
+		#ifndef DBG_QM_MALLOC
49
+			#define DBG_QM_MALLOC
50
+		#endif
51
+	#elif defined(DBG_QM_MALLOC)
52
+		#define DBG_F_MALLOC
53
+	#endif
54
+#endif
55
+
45 56
 #ifdef PKG_MALLOC
46 57
 #	ifdef VQ_MALLOC
47 58
 #		include "vq_malloc.h"
... ...
@@ -66,11 +77,14 @@
66 77
 				__FUNCTION__, __LINE__)
67 78
 #			define pkg_free(p)   vqm_free(mem_block, (p), __FILE__,  \
68 79
 				__FUNCTION__, __LINE__)
80
+#			warn "no proper realloc implementation, use another mem. alloc"
69 81
 #		elif defined F_MALLOC
70 82
 #			define pkg_malloc(s) fm_malloc(mem_block, (s),__FILE__, \
71 83
 				__FUNCTION__, __LINE__)
72 84
 #			define pkg_free(p)   fm_free(mem_block, (p), __FILE__,  \
73 85
 				__FUNCTION__, __LINE__)
86
+#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s),__FILE__, \
87
+				__FUNCTION__, __LINE__)
74 88
 #		else
75 89
 #			define pkg_malloc(s) qm_malloc(mem_block, (s),__FILE__, \
76 90
 				__FUNCTION__, __LINE__)
... ...
@@ -85,6 +99,7 @@
85 99
 #			define pkg_free(p)   vqm_free(mem_block, (p))
86 100
 #		elif defined F_MALLOC
87 101
 #			define pkg_malloc(s) fm_malloc(mem_block, (s))
102
+#			define pkg_realloc(p, s) fm_realloc(mem_block, (p), (s))
88 103
 #			define pkg_free(p)   fm_free(mem_block, (p))
89 104
 #		else
90 105
 #			define pkg_malloc(s) qm_malloc(mem_block, (s))
Browse code

- preliminary tls support - added qm_realloc/pkg_realloc/shm_realloc (needed by libssl)

Andrei Pelinescu-Onciul authored on 30/06/2003 10:04:02
Showing 1 changed files
... ...
@@ -74,6 +74,8 @@
74 74
 #		else
75 75
 #			define pkg_malloc(s) qm_malloc(mem_block, (s),__FILE__, \
76 76
 				__FUNCTION__, __LINE__)
77
+#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s),__FILE__, \
78
+				__FUNCTION__, __LINE__)
77 79
 #			define pkg_free(p)   qm_free(mem_block, (p), __FILE__,  \
78 80
 				__FUNCTION__, __LINE__)
79 81
 #		endif
... ...
@@ -86,6 +88,7 @@
86 88
 #			define pkg_free(p)   fm_free(mem_block, (p))
87 89
 #		else
88 90
 #			define pkg_malloc(s) qm_malloc(mem_block, (s))
91
+#			define pkg_realloc(p, s) qm_realloc(mem_block, (p), (s))
89 92
 #			define pkg_free(p)   qm_free(mem_block, (p))
90 93
 #		endif
91 94
 #	endif
Browse code

- split init_mallocs into init_pkg_mallocs & init_shm_mallocs - init_shm_mallocs called after cmd. line parsing (so -m is not ignored any more)

Andrei Pelinescu-Onciul authored on 08/04/2003 16:02:43
Showing 1 changed files
... ...
@@ -31,6 +31,8 @@
31 31
  * --------
32 32
  *  2003-03-10  __FUNCTION__ is a gcc-ism, defined it to "" for sun cc
33 33
  *               (andrei)
34
+ *  2003-03-07  split init_malloc into init_pkg_mallocs & init_shm_mallocs 
35
+ *               (andrei)
34 36
  */
35 37
 
36 38
 
... ...
@@ -109,6 +111,7 @@
109 111
 #	define pkg_status()
110 112
 #endif
111 113
 
112
-int init_mallocs();
114
+int init_pkg_mallocs();
115
+int init_shm_mallocs();
113 116
 
114 117
 #endif
Browse code

- removed some extra ';' from the malloc debugging macro definitions

Andrei Pelinescu-Onciul authored on 19/03/2003 18:41:14
Showing 1 changed files
... ...
@@ -66,14 +66,14 @@
66 66
 				__FUNCTION__, __LINE__)
67 67
 #		elif defined F_MALLOC
68 68
 #			define pkg_malloc(s) fm_malloc(mem_block, (s),__FILE__, \
69
-				__FUNCTION__, __LINE__);
69
+				__FUNCTION__, __LINE__)
70 70
 #			define pkg_free(p)   fm_free(mem_block, (p), __FILE__,  \
71
-				__FUNCTION__, __LINE__);
71
+				__FUNCTION__, __LINE__)
72 72
 #		else
73 73
 #			define pkg_malloc(s) qm_malloc(mem_block, (s),__FILE__, \
74
-				__FUNCTION__, __LINE__);
74
+				__FUNCTION__, __LINE__)
75 75
 #			define pkg_free(p)   qm_free(mem_block, (p), __FILE__,  \
76
-				__FUNCTION__, __LINE__);