This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
tutorials:troubleshooting:memory [2015/01/16 17:06] miconda [OS Memory Reports] |
tutorials:troubleshooting:memory [2015/05/14 13:46] miconda [OS Memory Reports] |
||
---|---|---|---|
Line 63: | Line 63: | ||
* if the number of subscribers, | * if the number of subscribers, | ||
- | ===== Troubleshooting ===== | ||
===== Memory Manager Debugging ===== | ===== Memory Manager Debugging ===== | ||
Line 148: | Line 147: | ||
if($i> | if($i> | ||
if($a-> | if($a-> | ||
+ | printf " | ||
+ | p $a | ||
+ | p (void*)((char*)($a)+sizeof(struct qm_frag)) | ||
+ | printf " | ||
p *$a | p *$a | ||
end | end | ||
+ | end | ||
+ | set $a = ((struct qm_frag*)((char*)($a)+sizeof(struct qm_frag)+((struct qm_frag*)$a)-> | ||
+ | set $i = $i + 1 | ||
+ | end | ||
+ | </ | ||
+ | |||
+ | An alternative is to print all used chunks, but be aware that it may take some time: | ||
+ | |||
+ | |||
+ | <code c> | ||
+ | set $i=0 | ||
+ | set $a = mem_block-> | ||
+ | while($a < mem_block-> | ||
+ | if($a-> | ||
+ | printf " | ||
+ | p $a | ||
+ | p (void*)((char*)($a)+sizeof(struct qm_frag)) | ||
+ | printf " | ||
+ | p *$a | ||
end | end | ||
set $a = ((struct qm_frag*)((char*)($a)+sizeof(struct qm_frag)+((struct qm_frag*)$a)-> | set $a = ((struct qm_frag*)((char*)($a)+sizeof(struct qm_frag)+((struct qm_frag*)$a)-> | ||
Line 167: | Line 189: | ||
gdb --batch --command=/ | gdb --batch --command=/ | ||
</ | </ | ||
+ | |||
+ | ===== 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, | ||
+ | |||
+ | <code c> | ||
+ | diff --git a/ | ||
+ | index 3890668..12ca37a 100644 | ||
+ | --- a/ | ||
+ | +++ b/ | ||
+ | @@ -621,7 +621,7 @@ C_DEFS= $(extra_defs) \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | - -DPKG_MALLOC \ | ||
+ | + -DDBG_SYS_MALLOC \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | After updating Makefile.defs recompile and reinstall. | ||
===== OS Memory Reports ===== | ===== OS Memory Reports ===== |