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

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


2010/4/8 Iñaki Baz Castillo <ibc at aliax.net>:
> 2010/4/8 Daniel-Constantin Mierla <miconda at gmail.com>:
>> it does not look as a dump with memory debugging on.
>
> SOrry, I just applied "MEMDBG=1" in one of the servers and got the
> output in the other.
>
>
>> When memdbg is on, you should get something like:
>>
>>    0(17665)       1. N  address=0xb5ab2440 frag=0xb5ab2428 size=4 used=1
>>    0(17665)             alloc'd from timer.c: init_timer(52)
>>
>> Notice the "alloc'd ...' line which specifies the place where the memory was
>> allocated.
>>
>> A leak is signaled by many occurrences of allocation from same place
>> (skipping the part of allocation done for config parsing and module
>> initialization which happen only one, at startup).


Hi again. I already have a kamailio 1.5.4 compiled with mem debugging
(as "kamailio -V" shows DBG_QM_MALLOC flag).

In config file I have:

  debug=3
  memlog=3 # Same behaviour with 1 or 2 as it equal or less than 'debug'.


Unfortunatelly the ammount of logs it generates makes it unusable for
production environment (~ 10 calls per second). Just restarting
kamailio when memlog is enabled takes really long time (unfortuantelly
I must restart it when adding new entries to 'address' table due to
the issue when performing "fifo address_reload" which completely
freezes kamailio sometimes).

Do I miss something? is it possible to log allocated and freeded
memory without generating so many logs?


If not, I could use "memlog=1" without memory debugging compiled and I
would check periodically the ammounf of PKG memory used. This is, I
get this output:

  kamailio[11770]: Memory status (pkg):
  kamailio[11770]: fm_status (0x701a40):
  kamailio[11770]:  heap size= 16777216
  kamailio[11770]:  used= 190936, used+overhead=250696, free=16526520
  kamailio[11770]:  max used (+overhead)= 258464

I can check it periodically and inspect if the used memory is
increasing. If so there must be a memleak. Am I right?


Thanks.

-- 
Iñaki Baz Castillo
<ibc at aliax.net>




More information about the sr-users mailing list