[Freeswitch-users] Memory leak when using ESL

Dmitry Sytchev kbdfck at gmail.com
Wed Nov 13 16:21:08 MSK 2013


Please create a JIRA ticket with your information!


2013/11/13 gggyniidt <gggyniidt at gmail.com>

> Thanks for Dmitry and Anthony's help, But my problem is not like Dmitry
> said.
>
> My program is a esl client. The leak is from esl client, not freeswitch.
>
> I add the Anthony's patch code into esl.c,but it doesn't work. Each call
> will cause the 20-40KB of memory growth.
>
> I  make 3 calls, the valgrind outputs like this
>
> ==14459== 90,642 (264 direct, 90,378 indirect) bytes in 3 blocks are
> definitely lost in loss record 403 of 408
> ==14459==    at 0x4A06AAA: malloc (vg_replace_malloc.c:291)
>
> ==14459==    by 0x414524: esl_event_create_subclass (esl_event.c:179)
>
> ==14459==    by 0x412054: esl_recv_event (esl.c:1245)
>
> ==14459==    by 0x411C38: esl_recv_event_timed (esl.c:1137)
>
> ==14459==    by 0x412E22: esl_send_recv_timed (esl.c:1521)
>
> ==14459==    by 0x410C06: esl_execute (esl.c:555)
>
> ==14459==    by 0x4087A8: CRBT::Route() (CRBT.cpp:42)
>
> ==14459==    by 0x409FE6: DPL::route() (DPL.cpp:286)
>
> ==14459==    by 0x40FBE0: mycallback(int, int, sockaddr_in*)
> (listener.cpp:47)
> ==14459==    by 0x410FED: client_thread (esl.c:654)
>
> ==14459==    by 0x41A334: thread_launch (esl_threadmutex.c:74)
>
> ==14459==    by 0x34CAA07850: start_thread (in /lib64/libpthread-2.12.so)
>
> ==14459==
>
> ==14459== LEAK SUMMARY:
> ==14459==    definitely lost: 264 bytes in 3 blocks
> ==14459==    indirectly lost: 90,378 bytes in 228 blocks
> ==14459==      possibly lost: 550,082 bytes in 51 blocks
> ==14459==    still reachable: 832,938 bytes in 840 blocks
> ==14459==         suppressed: 0 bytes in 0 blocks
> ==14459== Reachable blocks (those to which a pointer was found) are not
> shown.
> ==14459== To see them, rerun with: --leak-check=full --show-leak-kinds=all
>
> I checked my code and no leak found. The leak may be in esl.c.
>
>
>
> 2013/11/13 Anthony Minessale <anthony.minessale at gmail.com>
>
>> You are showing valgrind traces of ESL client code but now you are saying
>> your FS process has memory growth not the ESL app?
>> You should be doing this on jira and you should have more details about
>> the env.
>> This mailing list is not for bug reports.
>>
>> I did push a patch for what I think might be the problem you showed on
>> esl lib.
>>
>> 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.
>>
>>
>>
>>
>> On Tue, Nov 12, 2013 at 11:17 AM, Dmitry Sytchev <kbdfck at gmail.com>wrote:
>>
>>> 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't do tests at production server.
>>> With less than 300 channels in peak we have 900MB FS process size, never
>>> shrinking back :(
>>>
>>>
>>>
>>>
>>> 2013/11/12 gggyniidt <gggyniidt at gmail.com>
>>>
>>>> Hello
>>>>   Using ESL found a memory leak problem
>>>>    valgrind --tool=memcheck --leak-check=full ./myprog
>>>>   output as follows
>>>>
>>>> ==6872== 29,986 (88 direct, 29,898 indirect) bytes in 1 blocks are
>>>> definitely lost in loss record 401 of 408
>>>> ==6872==    at 0x4A06AAA: malloc (vg_replace_malloc.c:291)
>>>> ==6872==    by 0x413941: esl_event_create_subclass (esl_event.c:179)
>>>>
>>>> ==6872==    by 0x410DC3: esl_recv_event (esl.c:1245)
>>>>
>>>> ==6872==    by 0x411675: esl_send_recv_timed (esl.c:1517)
>>>>
>>>> ==6872==    by 0x411C1B: esl_execute (esl.c:555)
>>>>
>>>> ==6872==    by 0x408758: CRBT::Route() (CRBT.cpp:42)
>>>>
>>>> ==6872==    by 0x40A02F: DPL::route() (DPL.cpp:234)
>>>>
>>>> ==6872==    by 0x40FCA8: mycallback(int, int, sockaddr_in*)
>>>> (listener.cpp:47)
>>>> ==6872==    by 0x41032F: client_thread (esl.c:654)
>>>>
>>>> ==6872==    by 0x413FC7: thread_launch (esl_threadmutex.c:74)
>>>>
>>>> ==6872==    by 0x34CAA07850: start_thread (in /lib64/libpthread-2.12.so)
>>>>
>>>> ==6872==    by 0x34CA6E890C: clone (in /lib64/libc-2.12.so)
>>>>
>>>>
>>>> ==6872== LEAK SUMMARY:
>>>> ==6872==    definitely lost: 88 bytes in 1 blocks
>>>> ==6872==    indirectly lost: 29,898 bytes in 76 blocks
>>>> ==6872==      possibly lost: 550,082 bytes in 51 blocks
>>>> ==6872==    still reachable: 832,937 bytes in 840 blocks
>>>> ==6872==         suppressed: 0 bytes in 0 blocks
>>>> ==6872== Reachable blocks (those to which a pointer was found) are not
>>>> shown.
>>>> ==6872== To see them, rerun with: --leak-check=full
>>>> --show-leak-kinds=all
>>>>
>>>>
>>>>
>>>>    Part of my code is as follows
>>>>
>>>> bool CRBT::Route() {
>>>> string data = "ringback=file_string://";
>>>> data.append(FileName);
>>>>
>>>> esl_execute(handle, "set", data.c_str(), NULL);
>>>> return true;
>>>> }
>>>>
>>>> The OS version is Centos x86_64 6.3
>>>> The Freeswitch version is 1.2.13
>>>>
>>>> Thanks for your help.
>>>>
>>>>
>>>> _________________________________________________________________________
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> 
>>>> 
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>>
>>> --
>>> Best regards,
>>>
>>> Dmitry Sytchev,
>>> IT Engineer
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>>
>> --
>> Anthony Minessale II
>>
>> FreeSWITCH http://www.freeswitch.org/
>> ClueCon http://www.cluecon.com/
>> Twitter: http://twitter.com/FreeSWITCH_wire
>>
>> AIM: anthm
>> MSN:anthony_minessale at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>


-- 
Best regards,

Dmitry Sytchev,
IT Engineer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131113/e41cc785/attachment-0001.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list