### Description
I want to be sure my customization does not produce memory leack. To get this work I want to use the ASAN project.
Could you add `mode=asan` build option that adds gcc ` -fsanitize=address -static-libasan` options `-lasan` linker flags.
More info https://www.osc.edu/resources/getting_started/howto/howto_use_address_saniti...
Maybe important. ASAN expects linked first ``` [root@b276215a3a22 kamailio]# kamailio -DD -E ==13760==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD. ```
@sergey-safarov - if kamailio is compiled with pkg memory, then external tools cannot detect its memory leaks in most of the cases. There are few places where kamailio is still using the system memory manager (iirc, rpc commands build the output in system memory). Otherwise kamailio allocates a big chunk of system memory at startup and that's it, at runtime the pkg allocator works inside that chunk. There is option to compile to use system memory manager instead pkg, but that's not the default.
Normally, you can pass compiler or linker extra cli parameters via:
``` CC_EXTRA_OPTS=... LD_EXTRA_OPTS=... make ... ```
Of course, you can also make a new mode if you want to be persistent in the src/Makefile.defs -- in such case, just make a pull request.
If you feel there is more to discuss here, then reopen.
Closed #2650.