<div dir="ltr">Sorry,I reply this late.<div>In these days I did some test for esl client app.My code like this:</div><div><br></div><div><div>#include &lt;stdio.h&gt;</div><div>#include &lt;stdlib.h&gt;</div><div>#include &lt;esl.h&gt;</div>
<div><br></div><div><br></div><div>static void mycallback(esl_socket_t server_sock, esl_socket_t client_sock, struct sockaddr_in *addr)</div><div>{</div><div><span class="" style="white-space:pre">        </span>esl_handle_t handle = {{0}};</div>
<div><span class="" style="white-space:pre">        </span>int done = 0;</div><div><span class="" style="white-space:pre">        </span>esl_status_t status;</div><div><span class="" style="white-space:pre">        </span>time_t exp = 0;</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_attach_handle(&amp;handle, client_sock, addr);</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, &quot;Connected! %d\n&quot;, handle.sock);</div>
<div><br></div><div><span class="" style="white-space:pre">        </span>esl_filter(&amp;handle, &quot;unique-id&quot;, esl_event_get_header(handle.info_event, &quot;caller-unique-id&quot;));</div><div><span class="" style="white-space:pre">        </span>esl_events(&amp;handle, ESL_EVENT_TYPE_PLAIN, &quot;SESSION_HEARTBEAT CHANNEL_ANSWER CHANNEL_ORIGINATE CHANNEL_PROGRESS CHANNEL_HANGUP &quot;</div>
<div><span class="" style="white-space:pre">                        </span>   &quot;CHANNEL_BRIDGE CHANNEL_UNBRIDGE CHANNEL_OUTGOING CHANNEL_EXECUTE CHANNEL_EXECUTE_COMPLETE DTMF CUSTOM conference::maintenance&quot;);</div><div><br></div><div>
<span class="" style="white-space:pre">        </span>esl_send_recv(&amp;handle, &quot;linger&quot;);</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_execute(&amp;handle, &quot;set&quot;, &quot;recfile=/usr/local/rec/test.gsm&quot;, NULL);</div>
<div><span class="" style="white-space:pre">        </span>esl_send_recv(&amp;handle,&quot;api sofia status profile internal reg 6100010030100\n\n&quot;);</div><div><span class="" style="white-space:pre">        </span>char *b=esl_event_get_body(handle.last_sr_event);</div>
<div><span class="" style="white-space:pre">        </span>printf(&quot;%s\r\n&quot;, b);</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_send_recv(&amp;handle,&quot;api sofia status profile internal reg 6100010030200\n\n&quot;);</div>
<div><span class="" style="white-space:pre">        </span>b=esl_event_get_body(handle.last_sr_event);</div><div><span class="" style="white-space:pre">        </span>printf(&quot;%s\r\n&quot;, b);</div><div><br></div><div><br></div><div>
<span class="" style="white-space:pre">        </span>while((status = esl_recv_timed(&amp;handle, 1000)) != ESL_FAIL) {</div><div><span class="" style="white-space:pre">                </span>if (done) {</div><div><span class="" style="white-space:pre">                        </span>if (time(NULL) &gt;= exp) {</div>
<div><span class="" style="white-space:pre">                                </span>break;</div><div><span class="" style="white-space:pre">                        </span>}</div><div><span class="" style="white-space:pre">                </span>} else if (status == ESL_SUCCESS) {</div>
<div><span class="" style="white-space:pre">                        </span>const char *type = esl_event_get_header(handle.last_event, &quot;content-type&quot;);</div><div><span class="" style="white-space:pre">                        </span>if (type &amp;&amp; !strcasecmp(type, &quot;text/disconnect-notice&quot;)) {</div>
<div><span class="" style="white-space:pre">                                </span>const char *dispo = esl_event_get_header(handle.last_event, &quot;content-disposition&quot;);</div><div><span class="" style="white-space:pre">                                </span>esl_log(ESL_LOG_INFO, &quot;Got a disconnection notice dispostion: [%s]\n&quot;, dispo ? dispo : &quot;&quot;);</div>
<div><span class="" style="white-space:pre">                                </span>if (dispo &amp;&amp; !strcmp(dispo, &quot;linger&quot;)) {</div><div><span class="" style="white-space:pre">                                        </span>done = 1;</div><div><span class="" style="white-space:pre">                                        </span>esl_log(ESL_LOG_INFO, &quot;Waiting 5 seconds for any remaining events.\n&quot;);</div>
<div><span class="" style="white-space:pre">                                        </span>exp = time(NULL) + 5;</div><div><span class="" style="white-space:pre">                                </span>}</div><div><span class="" style="white-space:pre">                        </span>}</div><div><span class="" style="white-space:pre">                </span>}</div>
<div><span class="" style="white-space:pre">        </span>}</div><div><br></div><div><span class="" style="white-space:pre">        </span>esl_log(ESL_LOG_INFO, &quot;Disconnected! %d\n&quot;, handle.sock);</div><div><span class="" style="white-space:pre">        </span>esl_disconnect(&amp;handle);</div>
<div>}</div><div><br></div><div>int main(){</div><div><span class="" style="white-space:pre">        </span>esl_global_set_default_logger(0);</div><div><span class="" style="white-space:pre">        </span>esl_listen_threaded(&quot;localhost&quot;, 8084, mycallback, 100000);</div>
<div><span class="" style="white-space:pre">        </span>return 0;</div><div>}</div></div><div><br></div><div><br></div><div>I made 10 calls from a rtmp client to a eyeBeam client. sometimes there was no lake, but sometimes there was still a leak .</div>
<div><span style="font-family:arial,sans-serif;font-size:14px">The </span>valgrind<span style="font-family:arial,sans-serif;font-size:14px"> full log </span><span style="font-family:arial,sans-serif;font-size:14px">as follows</span></div>
<div><br></div><div><div><div>valgrind --tool=memcheck --leak-check=full ./wtdpl                </div><div>==11071== Memcheck, a memory error detector                                             </div><div>==11071== Copyright (C) 2002-2013, and GNU GPL&#39;d, by Julian Seward et al.               </div>
<div>==11071== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info             </div><div>==11071== Command: ./wtdpl                                                              </div><div>==11071==                                                                               </div>
<div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2321)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2320)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2319)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2318)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2316)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2315)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2314)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2313)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2312)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div><div>Call-ID:        Y2VkZjY4MzY4OTFmZDMxZjJkY2FkNmQ1OWZkNjg5YTU.                                     </div>
<div>User:           <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div><div>Contact:        &quot;abc&quot; &lt;sip:6100010030100@192.168.1.6:2964;rinstance=239a1e88dd886ca0&gt;     </div>
<div>Agent:          eyeBeam release 1011d stamp 40820                                                </div><div>Status:         Registered(UDP)(unknown) EXP(2013-11-16 12:31:53) EXPSECS(2310)                  </div><div>
Host:           <a href="http://test.u1u2u3.com">test.u1u2u3.com</a>                                                                  </div><div>IP:             192.168.1.6                                                                      </div>
<div>Port:           2964                                                                             </div><div>Auth-User:      6100010030100                                                                    </div><div>
Auth-Realm:     192.168.1.200                                                                    </div><div>MWI-Account:    <a href="mailto:6100010030100@192.168.1.200">6100010030100@192.168.1.200</a>                                                      </div>
<div><br></div><div>Total items returned: 1</div><div>=================================================================================================</div><div><br></div><div><br></div><div>Registrations:</div><div>=================================================================================================</div>
<div>Total items returned: 0                                                                          </div><div>=================================================================================================</div><div>
<br></div><div>^C==11071==</div><div>==11071== HEAP SUMMARY:</div><div>==11071==     in use at exit: 26,309,844 bytes in 2,639 blocks</div><div>==11071==   total heap usage: 14,394 allocs, 11,755 frees, 66,216,694 bytes allocated</div>
<div>==11071==</div><div>==11071== 1,152 bytes in 4 blocks are possibly lost in loss record 41 of 51</div><div>==11071==    at 0x4A0580F: calloc (vg_replace_malloc.c:618)</div><div>==11071==    by 0x34C9E11892: _dl_allocate_tls (in /lib64/<a href="http://ld-2.12.so">ld-2.12.so</a>)</div>
<div>==11071==    by 0x34CAA07068: pthread_create@@GLIBC_2.2.5 (in /lib64/<a href="http://libpthread-2.12.so">libpthread-2.12.so</a>)</div><div>==11071==    by 0x405CFC: esl_thread_create_detached_ex (esl_threadmutex.c:118)</div>
<div>==11071==    by 0x402410: esl_listen_threaded (esl.c:771)</div><div>==11071==    by 0x401CD6: main (wtdpl.cpp:58)</div><div>==11071==</div><div>==11071== 4,008 (88 direct, 3,920 indirect) bytes in 1 blocks are definitely lost in loss record 43 of 51</div>
<div>==11071==    at 0x4A06AAA: malloc (vg_replace_malloc.c:291)</div><div>==11071==    by 0x4056B1: esl_event_create_subclass (esl_event.c:179)</div><div>==11071==    by 0x402B33: esl_recv_event (esl.c:1245)</div><div>==11071==    by 0x4033E5: esl_send_recv_timed (esl.c:1517)</div>
<div>==11071==    by 0x401AE1: mycallback(int, int, sockaddr_in*) (wtdpl.cpp:28)</div><div>==11071==    by 0x40209F: client_thread (esl.c:654)</div><div>==11071==    by 0x405D37: thread_launch (esl_threadmutex.c:74)</div>
<div>==11071==    by 0x34CAA07850: start_thread (in /lib64/<a href="http://libpthread-2.12.so">libpthread-2.12.so</a>)</div><div>==11071==    by 0x34CA6E890C: clone (in /lib64/<a href="http://libc-2.12.so">libc-2.12.so</a>)</div>
<div>==11071==</div><div>==11071== LEAK SUMMARY:</div><div>==11071==    definitely lost: 88 bytes in 1 blocks</div><div>==11071==    indirectly lost: 3,920 bytes in 10 blocks</div><div>==11071==      possibly lost: 1,152 bytes in 4 blocks</div>
<div>==11071==    still reachable: 26,304,684 bytes in 2,624 blocks</div><div>==11071==         suppressed: 0 bytes in 0 blocks</div><div>==11071== Reachable blocks (those to which a pointer was found) are not shown.</div>
<div>==11071== To see them, rerun with: --leak-check=full --show-leak-kinds=all</div><div>==11071==</div><div>==11071== For counts of detected and suppressed errors, rerun with: -v</div><div>==11071== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 4 from 4)</div>
</div></div><div><br></div><div><br></div><div>Looking forward to your help<br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/14 Anthony Minessale <span dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I dug into ESL for a while.<div><br></div><div>I ran into some issues that I corrected but the only thing that I can see that would show up as a memory leak looking like what you show there is if you are doing a forking server and you are calling fork after you create or attach the handle.</div>

<div><br></div><div>Make sure you fork at the beginning or you will duplicate the handle and all the memory its using and it will never be destroyed.</div><div><br></div><div>If you do &quot;make&quot; in esl dir you will have a default app &quot;testserver_fork&quot; you can run and point to it with socket app to port 8040.</div>

<div>Running it on valgrind with full leak detection gives me.</div><div><br></div><div><br></div><div><div>==11807== Memcheck, a memory error detector</div><div>==11807== Copyright (C) 2002-2011, and GNU GPL&#39;d, by Julian Seward et al.</div>

<div>==11807== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright info</div><div>==11807== Command: ./testserver</div><div>==11807== Parent PID: 28177</div><div>==11807== </div><div>==11820== </div><div>==11820== HEAP SUMMARY:</div>

<div>==11820==     in use at exit: 0 bytes in 0 blocks</div><div>==11820==   total heap usage: 5,555 allocs, 5,555 frees, 7,293,931 bytes allocated</div><div>==11820== </div><div>==11820== All heap blocks were freed -- no leaks are possible</div>

<div>==11820== </div><div>==11820== For counts of detected and suppressed errors, rerun with: -v</div><div>==11820== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)</div><div>==11807== </div><div>==11807== HEAP SUMMARY:</div>

<div>==11807==     in use at exit: 0 bytes in 0 blocks</div><div>==11807==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated</div><div>==11807== </div><div>==11807== All heap blocks were freed -- no leaks are possible</div>

<div>==11807== </div><div>==11807== For counts of detected and suppressed errors, rerun with: -v</div><div>==11807== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 4 from 4)</div></div><div><br></div><div><br></div>

<div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 13, 2013 at 7:21 AM, Dmitry Sytchev <span dir="ltr">&lt;<a href="mailto:kbdfck@gmail.com" target="_blank">kbdfck@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Please create a JIRA ticket with your information!</div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/11/13 gggyniidt <span dir="ltr">&lt;<a href="mailto:gggyniidt@gmail.com" target="_blank">gggyniidt@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Thanks for Dmitry and Anthony&#39;s help, But my problem is not like Dmitry said. </div><div>

<br>
</div><div>My program is a esl client. The leak is from esl client, not freeswitch.</div><div><br></div>
<div>I add the Anthony&#39;s patch code into esl.c,but it doesn&#39;t work. Each call will cause the 20-40KB of memory growth.</div><div><br></div><div>I  make 3 calls, the valgrind outputs like this<br></div></div><div>


<span style="font-family:arial,sans-serif;font-size:14px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:14px"><div>==14459== 90,642 (264 direct, 90,378 indirect) bytes in 3 blocks are definitely lost in loss record 403 of 408               </div><div>==14459==    at 0x4A06AAA: malloc (vg_replace_malloc.c:291)                                                                  </div>



<div>==14459==    by 0x414524: esl_event_create_subclass (esl_event.c:179)                                                        </div><div>==14459==    by 0x412054: esl_recv_event (esl.c:1245)                                                                        </div>



<div>==14459==    by 0x411C38: esl_recv_event_timed (esl.c:1137)                                                                  </div><div>==14459==    by 0x412E22: esl_send_recv_timed (esl.c:1521)                                                                   </div>



<div>==14459==    by 0x410C06: esl_execute (esl.c:555)                                                                            </div><div>==14459==    by 0x4087A8: CRBT::Route() (CRBT.cpp:42)                                                                        </div>



<div>==14459==    by 0x409FE6: DPL::route() (DPL.cpp:286)                                                                         </div><div>==14459==    by 0x40FBE0: mycallback(int, int, sockaddr_in*) (listener.cpp:47)                                               </div>



<div>==14459==    by 0x410FED: client_thread (esl.c:654)                                                                          </div><div>==14459==    by 0x41A334: thread_launch (esl_threadmutex.c:74)                                                               </div>



<div>==14459==    by 0x34CAA07850: start_thread (in /lib64/<a href="http://libpthread-2.12.so" target="_blank">libpthread-2.12.so</a>)                                                    </div><div>==14459==    </div><div>


<br></div><div><div>
==14459== LEAK SUMMARY:</div><div>==14459==    definitely lost: 264 bytes in 3 blocks</div><div>==14459==    indirectly lost: 90,378 bytes in 228 blocks</div><div>==14459==      possibly lost: 550,082 bytes in 51 blocks</div>



<div>==14459==    still reachable: 832,938 bytes in 840 blocks</div><div>==14459==         suppressed: 0 bytes in 0 blocks</div><div>==14459== Reachable blocks (those to which a pointer was found) are not shown.</div><div>



==14459== To see them, rerun with: --leak-check=full --show-leak-kinds=all</div></div><div><br></div></span></div><div>I checked my code and no leak found. The leak may be in esl.c.<span style="font-family:arial,sans-serif;font-size:14px"><br>



</span></div><div><span style="font-family:arial,sans-serif;font-size:14px"><br></span></div></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/13 Anthony Minessale <span dir="ltr">&lt;<a href="mailto:anthony.minessale@gmail.com" target="_blank">anthony.minessale@gmail.com</a>&gt;</span><br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">You are showing valgrind traces of ESL client code but now you are saying your FS process has memory growth not the ESL app?<div>



You should be doing this on jira and you should have more details about the env.</div>
<div>This mailing list is not for bug reports.</div><div><br></div><div>I did push a patch for what I think might be the problem you showed on esl lib.</div><div><br></div><div>FS can use up to a gig of memory without giving it back.  To make sure you have a real memory leak you need to have it never peak but continue to grow.</div>




<div><br></div><div><br></div></div><div class="gmail_extra"><div><div><br><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 11:17 AM, Dmitry Sytchev <span dir="ltr">&lt;<a href="mailto:kbdfck@gmail.com" target="_blank">kbdfck@gmail.com</a>&gt;</span> wrote:<br>




<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I can confirm significant Freeswitch process memory growth over time when ESL is used intensively, from 100MB in normal case to 700-900MB after few hours of high esl load, though I have no valgrind check results, as I can&#39;t do tests at production server.</div>





<div>With less than 300 channels in peak we have 900MB FS process size, never shrinking back :(</div><div><br> </div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/12 gggyniidt <span dir="ltr">&lt;<a href="mailto:gggyniidt@gmail.com" target="_blank">gggyniidt@gmail.com</a>&gt;</span><br>





<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello<div><div>  Using ESL found a memory leak problem</div><div>   valgrind --tool=memcheck --leak-check=full ./myprog<br>





</div><div>  output as follows</div><div><br></div><div><div>==6872== 29,986 (88 direct, 29,898 indirect) bytes in 1 blocks are definitely lost in loss record 401 of 408                 </div>
<div>==6872==    at 0x4A06AAA: malloc (vg_replace_malloc.c:291)</div><div>==6872==    by 0x413941: esl_event_create_subclass (esl_event.c:179)                                                         </div><div>==6872==    by 0x410DC3: esl_recv_event (esl.c:1245)                                                                         </div>






<div>==6872==    by 0x411675: esl_send_recv_timed (esl.c:1517)                                                                    </div><div>==6872==    by 0x411C1B: esl_execute (esl.c:555)                                                                             </div>






<div>==6872==    by 0x408758: CRBT::Route() (CRBT.cpp:42)                                                                         </div><div>==6872==    by 0x40A02F: DPL::route() (DPL.cpp:234)                                                                          </div>






<div>==6872==    by 0x40FCA8: mycallback(int, int, sockaddr_in*) (listener.cpp:47)                                                </div><div>==6872==    by 0x41032F: client_thread (esl.c:654)                                                                           </div>






<div>==6872==    by 0x413FC7: thread_launch (esl_threadmutex.c:74)                                                                </div><div>==6872==    by 0x34CAA07850: start_thread (in /lib64/<a href="http://libpthread-2.12.so" target="_blank">libpthread-2.12.so</a>)                                                     </div>






<div>==6872==    by 0x34CA6E890C: clone (in /lib64/<a href="http://libc-2.12.so" target="_blank">libc-2.12.so</a>)  </div></div><div><br></div><div><br></div><div><div>==6872== LEAK SUMMARY:</div><div>==6872==    definitely lost: 88 bytes in 1 blocks</div>






<div>==6872==    indirectly lost: 29,898 bytes in 76 blocks</div><div>==6872==      possibly lost: 550,082 bytes in 51 blocks</div><div>==6872==    still reachable: 832,937 bytes in 840 blocks</div><div>==6872==         suppressed: 0 bytes in 0 blocks</div>






<div>==6872== Reachable blocks (those to which a pointer was found) are not shown.</div><div>==6872== To see them, rerun with: --leak-check=full --show-leak-kinds=all</div></div><div><br></div><div><br></div><div><br></div>






<div>   Part of my code is as follows</div></div><div><br></div><div><div>bool CRBT::Route() {</div><div><span style="white-space:pre-wrap">        </span>string data = &quot;ringback=file_string://&quot;;</div><div><span style="white-space:pre-wrap">        </span>data.append(FileName);<br>






</div><div><br></div><div><span style="white-space:pre-wrap">        </span>esl_execute(handle, &quot;set&quot;, data.c_str(), NULL);</div><div><span style="white-space:pre-wrap">        </span>return true;</div><div>}</div></div>
<div><br></div><div>The OS version is Centos x86_64 6.3</div><div>The Freeswitch version is 1.2.13</div><div><br></div><div>Thanks for your help.</div></div>
<br></div></div>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><span><font color="#888888"><br><br clear="all"><br>-- <br>Best regards,<br><br>Dmitry Sytchev,<br>IT Engineer
</font></span></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br></div></div>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>




Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>



GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>



<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:<a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a>
</div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards,<br><br>Dmitry Sytchev,<br>IT Engineer
</div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/" target="_blank">http://www.cluecon.com/</a><br>

Twitter: <a href="http://twitter.com/FreeSWITCH_wire" target="_blank">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com" target="_blank">MSN:anthony_minessale@hotmail.com</a><br>
GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com" target="_blank">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net" target="_blank">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org" target="_blank">sip:888@conference.freeswitch.org</a><br>
<a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org" target="_blank">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:<a href="tel:%2B19193869900" value="+19193869900" target="_blank">+19193869900</a>
</div>
</div></div><br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>