<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.2.2">
</HEAD>
<BODY>
Hello,<BR>
<BR>
Some of the memory leaks we found here at Crocodile were to do with the use of libxml2.<BR>
<BR>
Various calls to libxml2 functions resulted in libxml2 malloc'ing memory.&nbsp; This means you have to call the appropriate xmlFree...() functions in the Kamailio modules to free up this memory.&nbsp; In some places xmlFree() wasn't called, in other places xmlFree() was called when a different function (for example, xmlFreeDoc()) should have been used.<BR>
<BR>
These memory leaks were not in Kamailio shared or private memory so the statistics from Kamailio didn't show anything unusual.<BR>
<BR>
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.<BR>
<BR>
Regards,<BR>
<BR>
Peter<BR>
<BR>
<BR>
On Thu, 2012-01-26 at 14:53 +0200, Marius Zbihlei wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On 01/26/2012 02:34 PM, laura testi wrote:
&gt; Hi Hennings,
&gt; thanks a lot for your answer.
&gt;
&gt; I'm sending you other information about our Kamailio xmpp server.
&gt;
&gt; in attach the &quot;sercmd cfg.set_now_int core mem_dump_shm&quot; output.
&gt;
&gt; And here:
&gt;
&gt; kamctl fifo get_statistics | grep mem
&gt;
&gt; shmem:fragments = 13107
&gt; shmem:free_size = 99724520
&gt; shmem:max_used_size = 57559216
&gt; shmem:real_used_size = 34493208
&gt; shmem:total_size = 134217728
&gt; shmem:used_size = 25651280
&gt;
&gt; 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

</PRE>
</BLOCKQUOTE>
<BR>
<TABLE CELLSPACING="0" CELLPADDING="0" WIDTH="100%">
<TR>
<TD>
<PRE>
-- 
Peter Dunkley
Technical Director
Crocodile RCS Ltd
</PRE>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>