### Description I am creating a module that uses a 3rd party library(wolfSSL), that depending on build flags, requires alignment of memory blocks to be the same as `malloc`, i.e., 16 bytes on gcc/AMD64.
It seems that `shm_malloc` returns memory aligned to 8 bytes.
Since system malloc always returns 16-byte aligned memory, it might be good to match that behaviour in `shm_malloc` in case future kamailio modules use libraries that expect this.
### Expected behavior
`shm_malloc` returns memory aligned on `__alignof__(_max_align_t) == 16`
#### Actual observed behavior
`shm_malloc` returns blocks aligned on 8-bytes
#### Debugging Data When allocating `*SSL_CTX` and `*SSL ` structs by tls module they occassionally will have 8 byte (and not necessarily 16-byte) alignments. OpenSSL does not require 16-byte alignments but wolfSSL requires 16-byte alignments.
### Possible Solutions
* The custom memory allocators in WIP `tls_wolfssl/` could try to wrap around `shm_malloc`. * have a static build of wolfSSL that does not require 16-byte alignment
### Additional Information
The default `./configure` build of wolfSSL has structs that require 16-byte alignment. wolfSSL library has a configure flag `--enable-aligndata=no` that relaxes this requirement.
The qm allocator has a `ROUNDTO` of `16UL` so naturally provides 16-byte aligned memory.
However the flag `DBG_SR_MEMORY` causes `ROUNDTO` to be reduced to `sizeof(void *)`.
I see that's for q_malloc, but f_malloc and tlsf_malloc have `sizeof(void*)` or `2^3`. The memory managers can be selected with -x cli parameter.
Overall I am fine to increase it, but I see there are some comments about constraints with round value and size of some structs, so probably needs some checks to detect when it gets broken. Then some proper testing would be needed to catch eventual side effects.
I am closing the issue for now as it is too intrusive to alter the allocators for one module.
One future possiblity is to add a xx_malloc16 xx_realloc16 to explicitly request for 16-byte alignment for each allocator.
* For `tls_wolfssl` I will think of other strategies (bundling perhaps like OPENSIPS) * wrappers for `ser_*` functions that will internally align to 16: for realloc this costs one `memmove` if the returned array has different alignment from the alternative array
Closed #3157 as completed.