Module: kamailio
Branch: master
Commit: 80d1f10507190ae1a42c25f0c173188b8326b5b9
URL:
https://github.com/kamailio/kamailio/commit/80d1f10507190ae1a42c25f0c173188…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-11-10T14:08:09+01:00
core: qm/fm memory align size can be set with define KSR_MEMORY_ALIGN
- flexibility to be set at compile time via make or compiler parameter
---
Modified: src/core/mem/f_malloc.h
Modified: src/core/mem/q_malloc.h
---
Diff:
https://github.com/kamailio/kamailio/commit/80d1f10507190ae1a42c25f0c173188…
Patch:
https://github.com/kamailio/kamailio/commit/80d1f10507190ae1a42c25f0c173188…
---
diff --git a/src/core/mem/f_malloc.h b/src/core/mem/f_malloc.h
index c05a243af6f..5a9d28ece42 100644
--- a/src/core/mem/f_malloc.h
+++ b/src/core/mem/f_malloc.h
@@ -46,10 +46,15 @@
* can be 32 bits aligned => malloc should return multiple of long long
* aligned memory
* - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
* - sizeof(fm_frag) must be multiple of ROUNDTO!
*/
+#ifndef KSR_MEMORY_ALIGN
#define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
+
#define MIN_FRAG_SIZE ROUNDTO
diff --git a/src/core/mem/q_malloc.h b/src/core/mem/q_malloc.h
index b3bfaab3689..5b440688af3 100644
--- a/src/core/mem/q_malloc.h
+++ b/src/core/mem/q_malloc.h
@@ -39,10 +39,14 @@
* can be 32 bits aligned => malloc should return multiple of long long
* aligned memory
* - malloc() on gnu/linux: multiple of 8 or 16 on 64-bit systems
- * - for simplicity settle for 16 always
+ * - for simplicity settle for 16 by default
* - sizeof(qm_frag) and sizeof(qm_frag_end) must be multiple of ROUNDTO!
*/
+#ifndef KSR_MEMORY_ALIGN
#define ROUNDTO 16UL
+#else
+#define ROUNDTO KSR_MEMORY_ALIGN
+#endif
#define MIN_FRAG_SIZE ROUNDTO