User Tools

Site Tools


tutorials:troubleshooting:memory

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
tutorials:troubleshooting:memory [2015/01/16 17:37]
miconda [Using GDB]
tutorials:troubleshooting:memory [2015/09/04 00:01]
miconda [Memory Manager Debugging]
Line 63: Line 63:
   * if the number of subscribers, traffic is constant, no larger data was reloaded (e.g., dispacher, lcr), then there is very likely a memory leak that has to be discovered and fixed   * if the number of subscribers, traffic is constant, no larger data was reloaded (e.g., dispacher, lcr), then there is very likely a memory leak that has to be discovered and fixed
  
-===== Troubleshooting ===== 
  
 ===== Memory Manager Debugging ===== ===== Memory Manager Debugging =====
Line 114: Line 113:
     * for SHM memory:     * for SHM memory:
 <code> <code>
-kamcmd cfg.set_now_int core mem_dump_shm+kamcmd cfg.set_now_int core mem_dump_shm 1
 </code> </code>
  
Line 190: Line 189:
 gdb --batch --command=/tmp/kamailio-dump-used-pkg.gdb /usr/sbin/kamailio 21907 gdb --batch --command=/tmp/kamailio-dump-used-pkg.gdb /usr/sbin/kamailio 21907
 </code> </code>
 +
 +===== PKG With System Malloc =====
 +
 +Kamailio can be compiled to use system malloc and free for PKG needs. You have to remove the PKG_MALLOC define from Makefile.defs and can add DBG_SYS_MALLOC to get more verbosity with memory operations in debug mode.
 +
 +Next is a diff showing the changes in Makefile.defs, but note that lines may vary on your specific Kamailio version.
 +
 +<code c>
 +diff --git a/Makefile.defs b/Makefile.defs
 +index 3890668..12ca37a 100644
 +--- a/Makefile.defs
 ++++ b/Makefile.defs
 +@@ -621,7 +621,7 @@ C_DEFS= $(extra_defs) \
 +         -DSER_VER=$(SER_VER) \
 +         -DCFG_DIR='"$(cfg_target)"'\
 +         -DRUN_DIR='"$(run_target)"'\
 +-        -DPKG_MALLOC \
 ++        -DDBG_SYS_MALLOC \
 +         -DSHM_MEM  -DSHM_MMAP \
 +         -DDNS_IP_HACK \
 +         -DUSE_MCAST \
 +</code>
 +
 +After updating Makefile.defs recompile and reinstall.
 +
 +Other tools available out there (e.g., valgrind) can be then used to track the PKG memory operations done by Kamailio.
  
 ===== OS Memory Reports ===== ===== OS Memory Reports =====
tutorials/troubleshooting/memory.txt ยท Last modified: 2021/06/01 20:44 by giavac