Module: kamailio
Branch: master
Commit: 0d8a19fde8f46d175302f5fe77caed1bdef1a8bc
URL:
https://github.com/kamailio/kamailio/commit/0d8a19fde8f46d175302f5fe77caed1…
Author: Henning Westerholt <hw(a)skalatan.de>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2019-09-24T22:29:25+02:00
core: enable mem_join memory manager setting as default
- enable mem_join memory manager setting as default
- this should help with server stability in low memory situations
- some downstream projects (e.g. Kazoo) enables this already since years
---
Modified: src/core/cfg_core.c
Modified: src/core/mem/f_malloc.c
Modified: src/core/mem/q_malloc.c
---
Diff:
https://github.com/kamailio/kamailio/commit/0d8a19fde8f46d175302f5fe77caed1…
Patch:
https://github.com/kamailio/kamailio/commit/0d8a19fde8f46d175302f5fe77caed1…
---
diff --git a/src/core/cfg_core.c b/src/core/cfg_core.c
index d0b409f158..a23fb8afab 100644
--- a/src/core/cfg_core.c
+++ b/src/core/cfg_core.c
@@ -113,7 +113,7 @@ struct cfg_group_core default_core_cfg = {
3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
4 pkg_sums, 8 shm_sums, 16 short_status */
1, /*!< mem_safety - 0 disabled; 1 enabled */
- 0, /*!< mem_join - 0 disabled */
+ 1, /*!< mem_join - 1 enabled */
0, /*!< mem_status_mode - 0 only free fragments, 1 all fragements */
L_ERR, /*!< corelog */
L_DBG, /*!< latency cfg log */
diff --git a/src/core/mem/f_malloc.c b/src/core/mem/f_malloc.c
index a157f03172..836ba01219 100644
--- a/src/core/mem/f_malloc.c
+++ b/src/core/mem/f_malloc.c
@@ -656,7 +656,7 @@ void fm_free(void* qmp, void* p)
f->mname=mname;
#endif
#ifdef MEM_JOIN_FREE
- if(unlikely(cfg_get(core, core_cfg, mem_join)!=0))
+ if(likely(cfg_get(core, core_cfg, mem_join)!=0))
fm_join_frag(qm, f);
#endif /*MEM_JOIN_FREE*/
fm_insert_free(qm, f);
diff --git a/src/core/mem/q_malloc.c b/src/core/mem/q_malloc.c
index 52d2ef722c..b718dfa3bf 100644
--- a/src/core/mem/q_malloc.c
+++ b/src/core/mem/q_malloc.c
@@ -529,7 +529,7 @@ void qm_free(void* qmp, void* p)
qm->real_used-=size;
#ifdef MEM_JOIN_FREE
- if(unlikely(cfg_get(core, core_cfg, mem_join)!=0)) {
+ if(likely(cfg_get(core, core_cfg, mem_join)!=0)) {
next=prev=0;
/* mark this fragment as used (might fall into the middle of joined frags)
* to give us an extra chance of detecting a double free call (if the joined