[sr-dev] Per module memmory consumption

smititelu stefan.mititelu at 1and1.ro
Tue Jun 16 14:43:07 CEST 2015


Hello everyone,

We are thinking of a way to debug per module memory consumption (both 
private and shared). Something like a "kamctl fifo shmem***module_name*" 
to print how much memory has been alloc'ed for that module and which 
function had alloc'ed.

One of the solutions would be to make use of the shm_info() and 
pkg_info(), call them at the beginning and at the end of a function and 
do some subtraction at the end. Then correlate this data with a per 
module stats which will be printed with "kamctl stats *module_name*". 
This would be ok if one needs mem stats only for some specific modules.

Another solution would be to make use of the *_malloc stubs used when 
MEM_DEBUG is enabled and keep the function name and size. Buf it would 
be hard to count how much memory is alloc'ed by the higher module 
function in scenarios when the actual allocations are done in other 
modules (e.g. db_allocate_rows()).

Also we have in mind that one would not want to compile kamailio with 
MEM_DEBUG flag but still want to make use of the feature...

If you think of some other solution or have some advices for this, 
please comment.

Regards,
1&1 Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20150616/2d704f5f/attachment.html>


More information about the sr-dev mailing list