<br><div class="gmail_quote">On Tue, Nov 2, 2010 at 9:06 PM, Russell Bryant <span dir="ltr"><<a href="mailto:russell@digium.com">russell@digium.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br>
<br>
<br>
----- Original Message -----<br>
> hello,<br>
><br>
> i have finished the first part of my statechange patch and i have a<br>
> question about the right way / place to bring it in.<br>
><br>
> by now i have added one container for devices which are used in hints<br>
> so there is no iteration through the whole hint link list, just a hash<br>
> compare to the device (which we allready know) and a direct link to<br>
> the hint which includes this device.<br>
<br>
> the values i can see by now are just great but i have one problem.<br>
><br>
> for example in chan_sip.c there is a load and unload module function<br>
> where i can allocate and clean up a container but there is nothing in<br>
> pbx.c like this. i have just written a function which checks if the<br>
> container is allocated and if not, just allocate it if needed.<br>
> But i dont have an idea where i should clean this up in pbx.c, so my<br>
> patch would cause a memory leak.<br>
><br>
> any ideas where i can build this in?<br>
<br>
</div>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.<br>
<div class="im"><br>
> the next part of this patch would be the switch from a linklist for<br>
> hints to a real container but the performance improvment for<br>
> handlestatechange is nearly 85 times faster by now:<br>
><br>
> handle_statechange called: 28008 overalltime: 16791 ms (orig trunk)<br>
> handle_statechange called: 27952 overalltime: 200 ms (patched trunk)<br>
><br>
> thanks for your help!<br>
<br>
</div>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?</blockquote>
<div><br></div><div>A 1.4 based branch is located here:</div><div><br></div><div><a href="https://origsvn.digium.com/svn/asterisk/team/jpeeler/issue18165">https://origsvn.digium.com/svn/asterisk/team/jpeeler/issue18165</a></div>
<div><br></div><div>I was never able to reproduce the issue, so any testing is appreciated.</div><div><br></div><div>Jeff Peeler</div><div>Digium, Inc. | Software Developer</div><div>445 Jan Davis Drive NW - Huntsville, AL 35806 - USA</div>
<div>Check us out at <a href="http://www.digium.com">www.digium.com</a> & <a href="http://www.asterisk.org">www.asterisk.org</a> </div></div>