[Kamailio-Users] Understanding memory-leaks by inspecting PKG/SHM memory status at shutdown

Iñaki Baz Castillo ibc at aliax.net
Thu Apr 8 14:11:17 CEST 2010


2010/4/8 Daniel-Constantin Mierla <miconda at gmail.com>:

>> Do I miss something? is it possible to log allocated and freeded
>> memory without generating so many logs?
>>
>
> the goal is to see the places where the memory was allocated. That will give
> the proper hints about the leak.
>
> What you can do is to print pkg status only when you send SIGUSR1 -- I
> attached a patch for that.

Great, I'll use it in the standby server and will test with SIPp in
order to determine the possible memory leak.


> In this way, a restart does not print pkg and shm status, so it is fast. At
> runtime, when you send SIGUSR1 to a pid, the others can work just fine, so
> processing should not be affected that much. Use kamctl ps to spot the pid
> of an udp worker.

For this purpose I've created a bash script which does the job for me :)
I attach it.


In the production server (no mem debugging compiled)  I've created a
cron job which invokes the attached script every 5 minutes. Then with
other scritp I filter the PKG status from kamailio log file (rsyslog
logs it to a separate file) and get this output:

  Apr  8 13:55:01 kamailio[11770]:  used= 190936,
used+overhead=250696, free=16526520
  Apr  8 13:55:01 kamailio[11770]:  max used (+overhead)= 258464
  Apr  8 13:55:01 kamailio[11758]:  used= 191176,
used+overhead=250648, free=16526568
  Apr  8 13:55:01 kamailio[11758]:  max used (+overhead)= 257864
  Apr  8 14:05:01 kamailio[11770]:  used= 190936,
used+overhead=250696, free=16526520
  Apr  8 14:05:01 kamailio[11770]:  max used (+overhead)= 258464
  Apr  8 14:05:01 kamailio[11758]:  used= 191176,
used+overhead=250648, free=16526568
  Apr  8 14:05:01 kamailio[11758]:  max used (+overhead)= 257864


I cannot determine the memory leak cause with this, but I can
determine that some memory exists if the 'used' value is increased,
right?


Thanks a lot.





-- 
Iñaki Baz Castillo
<ibc at aliax.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kamailio_log_pkg_mem.sh
Type: application/x-sh
Size: 1386 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100408/d8a0c119/attachment.sh>


More information about the sr-users mailing list