<p>We are using the t_uac_dlg function through a UDP MI Datagram to create local SIP/TCP requests. We are seeing a memory leak of increasing shared Memory usage, which is increasing at the same rate as tcp connections are created (tested under 4.0.1 and 4.3.1).</p>

<pre><code>/usr/sbin/kamailio[25407]: NOTICE: fm_status:  count= 71943 size=  14126536 bytes from mi_datagram: datagram_fnc.c: build_async_handler(387)
</code></pre>

<p>After looking at the memory dump and investigating the source, I guess that the memory leak is created, when the</p>

<pre><code>MI_ASYNC_RPL_FLAG
</code></pre>

<p>is set. This seems to be set by:</p>

<pre><code>modules/tmx/tmx_mod.c:  {MI_TM_UAC,     mi_tm_uac_dlg,   MI_ASYNC_RPL_FLAG,  0,  0 },
</code></pre>

<p>only, which we are using heavily.</p>

<p>Can someone please give me a hint, where to search for the memory leak. My guess is that:</p>

<p>modules/mi_datagram/datagram_fnc.c:489</p>

<pre><code>if (f->flags&MI_ASYNC_RPL_FLAG) {
    hdl = build_async_handler(mi_socket_domain,
    (struct sockaddr* )&reply_addr, reply_addr_len);
</code></pre>

<p>the handler is not correctly freed up in the async reply case.</p>

<p>Thank you!</p>

<p>Greetings</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br>Reply to this email directly or <a href="https://github.com/kamailio/kamailio/issues/298">view it on GitHub</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AF36ZVahZQCRTN1wG0n4Agaxj_s6iEQnks5oq2KHgaJpZM4FxOr6.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/kamailio/kamailio/issues/298"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>