[Freeswitch-dev] How can I detect the cause of a potential memory leak?

François Delawarde fdelawarde at wirelessmundi.com
Tue Nov 15 12:25:16 MSK 2011


I did a small valgrind test with git HEAD:
1. turn on, make 5 calls or so 
2. leave FS on for the night (without calls)
3. shut it down cleanly in the morning

During execution, some "Warning: invalid file descriptor -1 in syscall
close()" (4-5 for each call + some extras).

After shutting down, something strikes me in the vg.log file:
"definitely lost: 173,407,885 bytes in 84,680 blocks"

Is this normal?

valgrind log: http://pastebin.freeswitch.org/17779

Thanks,
François.


On Mon, 2011-11-14 at 11:41 -0600, Anthony Minessale wrote:
> valgrind is your best bet:
> 
> valgrind --tool=memcheck --log-file=vg.log --leak-check=full
> --leak-resolution=high
> --show-reachable=yes /usr/local/freeswitch/bin/freeswitch -vg
> 
> 
> run this on normal traffic for a while and get the log file.
> 
> 
> if you unload mods it would not help with a leak but it would with a
> swelling pool.
> 
> 
> 
> On Mon, Nov 14, 2011 at 11:30 AM, François Delawarde
> <fdelawarde at wirelessmundi.com> wrote:
>         Hello,
>         
>         I'm experiencing what I think is a memory leak in a production
>         system
>         with a recent git (2-Nov), with FS consuming >5GB and
>         increasing after a
>         few days with never more than 10 calls at once.
>         
>         While the users are not experiencing problems so far, I'm a
>         bit worried.
>         So I have a few questions:
>         
>         - How can I be sure it's a leak and not some memory pool thing
>         that FS
>         would free when the system needs (system has 10GB total)?
>         
>         - If I unload modules one by one, is the memory used by this
>         module
>         freed immediately?
>         
>         - What would be a "good" way to try and narrow down the cause?
>         Is
>         valgrind a good tool for that?
>         
>         Of course I'll try with GIT HEAD and try my best to find the
>         cause
>         before considering to add a new Jira issue, otherwise it's
>         quite
>         useless.
>         
>         
>         Thanks,
>         François.
>         
>         
>         _________________________________________________________________________
>         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-dev mailing list
>         FreeSWITCH-dev at lists.freeswitch.org
>         http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
>         UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
>         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-dev mailing list
> FreeSWITCH-dev at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-dev
> http://www.freeswitch.org





Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-dev mailing list