<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">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 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 class="h5"><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">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>