[SR-Users] Memory usage problem in xmpp modules

Peter Dunkley peter.dunkley at crocodile-rcs.com
Thu Jan 26 14:06:20 CET 2012


Hello,

Some of the memory leaks we found here at Crocodile were to do with the
use of libxml2.

Various calls to libxml2 functions resulted in libxml2 malloc'ing
memory.  This means you have to call the appropriate xmlFree...()
functions in the Kamailio modules to free up this memory.  In some
places xmlFree() wasn't called, in other places xmlFree() was called
when a different function (for example, xmlFreeDoc()) should have been
used.

These memory leaks were not in Kamailio shared or private memory so the
statistics from Kamailio didn't show anything unusual.

As xmpp is an XML based protocol I would start by looking at where
libxml2 functions which allocate memory are being used and confirm that
the correct xmlFree...() functions are called during both normal and
abnormal cases.

Regards,

Peter


On Thu, 2012-01-26 at 14:53 +0200, Marius Zbihlei wrote:

> On 01/26/2012 02:34 PM, laura testi wrote:
> > Hi Hennings,
> > thanks a lot for your answer.
> >
> > I'm sending you other information about our Kamailio xmpp server.
> >
> > in attach the "sercmd cfg.set_now_int core mem_dump_shm" output.
> >
> > And here:
> >
> > kamctl fifo get_statistics | grep mem
> >
> > shmem:fragments = 13107
> > shmem:free_size = 99724520
> > shmem:max_used_size = 57559216
> > shmem:real_used_size = 34493208
> > shmem:total_size = 134217728
> > shmem:used_size = 25651280
> >
> > Thanks an kind regards,
> Hello,
> 
> This seems pretty low (and normal). Probably there are some problems 
> with external libraries (API) using malloc and not properly freeing 
> memory. This is not a problem with the library itself, but more with the 
> way the library is used. For example the libpcre library had this sort 
> of leak when used in the regex modules.
> 
> Look for external libraries (by checking the dependency list) for the 
> custom setup you have. Then, try to match every external library 
> instantiation(allocation) (via library method) to a corresponding 
> release of resources.
> 
> Cheers
> Marius
> 


-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120126/a6dfd20f/attachment.htm>


More information about the sr-users mailing list