[asterisk-dev] Help needed for main/pbx.c

Jeff Peeler jpeeler at digium.com
Wed Nov 3 11:47:27 CDT 2010


On Tue, Nov 2, 2010 at 9:06 PM, Russell Bryant <russell at digium.com> wrote:

>
>
>
> ----- Original Message -----
> > hello,
> >
> > i have finished the first part of my statechange patch and i have a
> > question about the right way / place to bring it in.
> >
> > by now i have added one container for devices which are used in hints
> > so there is no iteration through the whole hint link list, just a hash
> > compare to the device (which we allready know) and a direct link to
> > the hint which includes this device.
>
> > the values i can see by now are just great but i have one problem.
> >
> > for example in chan_sip.c there is a load and unload module function
> > where i can allocate and clean up a container but there is nothing in
> > pbx.c like this. i have just written a function which checks if the
> > container is allocated and if not, just allocate it if needed.
> > But i dont have an idea where i should clean this up in pbx.c, so my
> > patch would cause a memory leak.
> >
> > any ideas where i can build this in?
>
> Many of the files in main/ have an _init() function.  They are defined in
> include/asterisk/_private.h and executed by main/asterisk.c.  main/pbx.c
> already has one - load_pbx().  Add your initialization code there.
>
> > the next part of this patch would be the switch from a linklist for
> > hints to a real container but the performance improvment for
> > handlestatechange is nearly 85 times faster by now:
> >
> > handle_statechange called: 28008 overalltime: 16791 ms (orig trunk)
> > handle_statechange called: 27952 overalltime: 200 ms (patched trunk)
> >
> > thanks for your help!
>
> That looks great!  I'm interested to see how you did it.  I have a patch
> that converts hints to an astobj2 container, as well.  We should look at
> combining the two patches in a branch.  Jeff picked it up the patch from me
> before I left for AstriCon.  Jeff, is that code posted anywhere yet?


A 1.4 based branch is located here:

https://origsvn.digium.com/svn/asterisk/team/jpeeler/issue18165

I was never able to reproduce the issue, so any testing is appreciated.

Jeff Peeler
Digium, Inc. | Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at www.digium.com & www.asterisk.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20101103/788f197c/attachment.htm 


More information about the asterisk-dev mailing list