Browse code

core: pkg size can be set via compile option

- new makefile option PKG_MEM_SIZE that can be used to specify the size
in MB for PKG memory, e.g., make PKG_MEM_SIZE=8 cfg
- easier way to set the pkg size without messing with c code and defines
in config.h
- pkg size is printed by -V command line option

Daniel-Constantin Mierla authored on 16/07/2010 17:10:54
Showing 3 changed files
... ...
@@ -666,6 +666,9 @@ ifeq ($(MEMDBG), 1)
666 666
 else
667 667
 	C_DEFS+= -DF_MALLOC
668 668
 endif
669
+ifneq ($(PKG_MEM_SIZE),)
670
+	C_DEFS+= -DPKG_MEM_SIZE=$(PKG_MEM_SIZE)
671
+endif
669 672
 ifeq ($(CORE_TLS), 1)
670 673
 	C_DEFS+= -DUSE_TLS -DCORE_TLS
671 674
 endif
... ...
@@ -140,7 +140,10 @@
140 140
 
141 141
 #define SRV_MAX_PREFIX_LEN SRV_TLS_PREFIX_LEN
142 142
 
143
-#define PKG_MEM_POOL_SIZE 4*1024*1024		/*!< used only if PKG_MALLOC is defined*/
143
+#ifndef PKG_MEM_SIZE
144
+#define PKG_MEM_SIZE 4
145
+#endif
146
+#define PKG_MEM_POOL_SIZE PKG_MEM_SIZE*1024*1024	/*!< used only if PKG_MALLOC is defined*/
144 147
 
145 148
 #define SHM_MEM_SIZE 32				/*!< used if SH_MEM is defined*/
146 149
 
... ...
@@ -265,9 +265,9 @@ void print_ct_constants()
265 265
 #endif
266 266
 */
267 267
 	printf("MAX_RECV_BUFFER_SIZE %d, MAX_LISTEN %d,"
268
-			" MAX_URI_SIZE %d, BUF_SIZE %d\n",
268
+			" MAX_URI_SIZE %d, BUF_SIZE %d, PKG_SIZE %uMB\n",
269 269
 		MAX_RECV_BUFFER_SIZE, MAX_LISTEN, MAX_URI_SIZE,
270
-		BUF_SIZE );
270
+		BUF_SIZE, PKG_MEM_SIZE);
271 271
 #ifdef USE_TCP
272 272
 	printf("poll method support: %s.\n", poll_support);
273 273
 #endif