Re: [Freeswitch-users] Memory allocation "switch_core_session_alloc"
Mainly I’m not writing a new module, I’m modifying mod_spy to allow spying current active called without providing uuid, mainly I did the below: 1-Creat new hash map to contain all bridged calls(userid@domain as key, and UUID as value). 2-when I receive any spy request I query the hash map, using userid@domain, if I find a uuid and add it as if I get it in command “userspy userid@domain uuid “ 3-then I continue. The point that I try to allocate the memory on session level and once the call get hangup I remove it from the hash map, however this doesn’t work as I expect only one hangup request comes and accordingly one entry from hasp being removed. I attached here the code for your review From: Anthony Minessale <anthony.minessale@gmail.com <mailto:anthony.minessale@gmail.com>> Subject: Re: [Freeswitch-users] Memory allocation "switch_core_session_alloc" Date: March 31, 2016 at 1:51:48 AM GMT+3 To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> Reply-To: FreeSWITCH Users Help <freeswitch-users@lists.freeswitch.org <mailto:freeswitch-users@lists.freeswitch.org>> Correct. The memory is allocated from the session's pool and will not be valid when the call ends. For persistent memory allocation, create your own pool when the module loads, (or use the one passed to you in the init function) and use switch_core_alloc instead. What module are you writing? On Wed, Mar 30, 2016 at 4:48 PM, Ahmed habiba <ahabiba@gmail.com <mailto:ahabiba@gmail.com>> wrote: Hi, I’m trying to use “switch_core_session_alloc” in a new module however I notice in documentation the below note, does this mean that once the session hangup this memory segment will not be valid anymore and I should not use this segment again?, your kind feedback will be appreciated. "Note: the memory will be in scope as long as the session exists" Thanks, Ahmed Habiba. _________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org <mailto:consulting@freeswitch.org> http://www.freeswitchsolutions.com <http://www.freeswitchsolutions.com/> Official FreeSWITCH Sites http://www.freeswitch.org <http://www.freeswitch.org/> http://confluence.freeswitch.org <http://confluence.freeswitch.org/> http://www.cluecon.com <http://www.cluecon.com/> FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users <http://lists.freeswitch.org/mailman/listinfo/freeswitch-users> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users <http://lists.freeswitch.org/mailman/options/freeswitch-users> http://www.freeswitch.org <http://www.freeswitch.org/> -- Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬ ☞ http://freeswitch.org/ <http://freeswitch.org/> ☞ http://cluecon.com/ <http://cluecon.com/> ☞ http://twitter.com/FreeSWITCH <http://twitter.com/FreeSWITCH> ☞ irc.freenode.net <http://irc.freenode.net/> #freeswitch ☞ http://freeswitch.org/g+ <http://freeswitch.org/g+> ClueCon Weekly Development Call ☎ sip:888@conference.freeswitch.org <mailto:sip%3A888@conference.freeswitch.org> ☎ +19193869900 https://www.youtube.com/watch?v=9XXgW34t40s <https://www.youtube.com/watch?v=9XXgW34t40s> https://www.youtube.com/watch?v=NLaDpGQuZDA <https://www.youtube.com/watch?v=NLaDpGQuZDA>
participants (1)
-
Ahmed habiba