summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-07-13 13:12:36 +0000
committerBenny Prijono <bennylp@teluu.com>2008-07-13 13:12:36 +0000
commit0d89432ea61bea6901abc6a34dbb9a20172f75ab (patch)
tree87e5e668f3076abbcd255ad55ebc7cf49fc034e4 /pjsip
parent003ffd64e31edf3dc3e087e51a6ce33228563386 (diff)
Ticket #564: Reduce the memory usage for default pjsip settings
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2131 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsip/sip_config.h32
-rw-r--r--pjsip/src/pjsip-simple/evsub.c2
-rw-r--r--pjsip/src/pjsip-simple/publishc.c1
-rw-r--r--pjsip/src/pjsip/sip_transport_tcp.c8
-rw-r--r--pjsip/src/pjsip/sip_transport_tls_ossl.c8
5 files changed, 32 insertions, 19 deletions
diff --git a/pjsip/include/pjsip/sip_config.h b/pjsip/include/pjsip/sip_config.h
index d16245bf..34cae270 100644
--- a/pjsip/include/pjsip/sip_config.h
+++ b/pjsip/include/pjsip/sip_config.h
@@ -157,18 +157,24 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
/**
* Specify maximum transaction count in transaction hash table.
- * Default value is 16*1024
+ * For efficiency, the value should be 2^n-1 since it will be
+ * rounded up to 2^n.
+ *
+ * Default value is 1023
*/
#ifndef PJSIP_MAX_TSX_COUNT
-# define PJSIP_MAX_TSX_COUNT (16*1024)
+# define PJSIP_MAX_TSX_COUNT (1024-1)
#endif
/**
* Specify maximum number of dialogs in the dialog hash table.
- * Default value is 16*1024.
+ * For efficiency, the value should be 2^n-1 since it will be
+ * rounded up to 2^n.
+ *
+ * Default value is 511.
*/
#ifndef PJSIP_MAX_DIALOG_COUNT
-# define PJSIP_MAX_DIALOG_COUNT (16*1024)
+# define PJSIP_MAX_DIALOG_COUNT (512-1)
#endif
@@ -553,14 +559,14 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
* Initial memory size for UA layer
*/
#ifndef PJSIP_POOL_LEN_UA
-# define PJSIP_POOL_LEN_UA 4000
+# define PJSIP_POOL_LEN_UA 512
#endif
/**
* Memory increment for UA layer.
*/
#ifndef PJSIP_POOL_INC_UA
-# define PJSIP_POOL_INC_UA 4000
+# define PJSIP_POOL_INC_UA 512
#endif
#define PJSIP_MAX_FORWARDS_VALUE 70
@@ -571,17 +577,23 @@ PJ_INLINE(pjsip_cfg_t*) pjsip_cfg(void)
/* Transaction related constants. */
/**
- * Initial memory size for transaction layer
+ * Initial memory size for transaction layer. The bulk of pool usage
+ * for transaction layer will be used to create the hash table, so
+ * setting this value too high will not help too much with reducing
+ * fragmentation and the memory will most likely be wasted.
*/
#ifndef PJSIP_POOL_TSX_LAYER_LEN
-# define PJSIP_POOL_TSX_LAYER_LEN 4000
+# define PJSIP_POOL_TSX_LAYER_LEN 512
#endif
/**
- * Memory increment for transaction layer.
+ * Memory increment for transaction layer. The bulk of pool usage
+ * for transaction layer will be used to create the hash table, so
+ * setting this value too high will not help too much with reducing
+ * fragmentation and the memory will most likely be wasted.
*/
#ifndef PJSIP_POOL_TSX_LAYER_INC
-# define PJSIP_POOL_TSX_LAYER_INC 4000
+# define PJSIP_POOL_TSX_LAYER_INC 512
#endif
/**
diff --git a/pjsip/src/pjsip-simple/evsub.c b/pjsip/src/pjsip-simple/evsub.c
index 9d51a29d..84bc8dba 100644
--- a/pjsip/src/pjsip-simple/evsub.c
+++ b/pjsip/src/pjsip-simple/evsub.c
@@ -296,7 +296,7 @@ PJ_DEF(pj_status_t) pjsip_evsub_init_module(pjsip_endpoint *endpt)
pj_list_init(&mod_evsub.pkg_list);
/* Create pool: */
- mod_evsub.pool = pjsip_endpt_create_pool(endpt, "evsub", 4000, 4000);
+ mod_evsub.pool = pjsip_endpt_create_pool(endpt, "evsub", 512, 512);
if (!mod_evsub.pool)
return PJ_ENOMEM;
diff --git a/pjsip/src/pjsip-simple/publishc.c b/pjsip/src/pjsip-simple/publishc.c
index 6b54f53e..f55c8051 100644
--- a/pjsip/src/pjsip-simple/publishc.c
+++ b/pjsip/src/pjsip-simple/publishc.c
@@ -119,6 +119,7 @@ PJ_DEF(pj_status_t) pjsip_publishc_init_module(pjsip_endpoint *endpt)
return pjsip_endpt_add_capability( endpt, NULL, PJSIP_H_ALLOW, NULL,
1, &pjsip_publish_method.name);
*/
+ PJ_UNUSED_ARG(endpt);
return PJ_SUCCESS;
}
diff --git a/pjsip/src/pjsip/sip_transport_tcp.c b/pjsip/src/pjsip/sip_transport_tcp.c
index 8866417d..59f33e49 100644
--- a/pjsip/src/pjsip/sip_transport_tcp.c
+++ b/pjsip/src/pjsip/sip_transport_tcp.c
@@ -36,10 +36,10 @@
#define THIS_FILE "sip_transport_tcp.c"
#define MAX_ASYNC_CNT 16
-#define POOL_LIS_INIT 4000
-#define POOL_LIS_INC 4001
-#define POOL_TP_INIT 4000
-#define POOL_TP_INC 4002
+#define POOL_LIS_INIT 512
+#define POOL_LIS_INC 512
+#define POOL_TP_INIT 512
+#define POOL_TP_INC 512
struct tcp_listener;
struct tcp_transport;
diff --git a/pjsip/src/pjsip/sip_transport_tls_ossl.c b/pjsip/src/pjsip/sip_transport_tls_ossl.c
index 3c4fc706..4e31318b 100644
--- a/pjsip/src/pjsip/sip_transport_tls_ossl.c
+++ b/pjsip/src/pjsip/sip_transport_tls_ossl.c
@@ -66,10 +66,10 @@
#define THIS_FILE "transport_tls_ossl.c"
#define MAX_ASYNC_CNT 16
-#define POOL_LIS_INIT 4000
-#define POOL_LIS_INC 4001
-#define POOL_TP_INIT 4000
-#define POOL_TP_INC 4002
+#define POOL_LIS_INIT 512
+#define POOL_LIS_INC 512
+#define POOL_TP_INIT 512
+#define POOL_TP_INC 512