<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2137/">https://reviewboard.asterisk.org/r/2137/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers, Mark Michelson, rmudgett, and jcolp.</div>
<div>By Matt Jordan.</div>
<p style="color: grey;"><i>Updated Sept. 30, 2012, 8:37 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Cleaned up the description a tad.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description (updated)</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">While hunting for a channel ref leak, I found that after running the refcounter utility, there were a whole host of ao2 object ref leaks. Wondering if that was just my test causing that, I started Asterisk and immediately stopped it.
Nope, lots of ref leaks still.
This patch cleans up a fair number of them - so that at least with my admittedly limited configuration (which had a number of modules excluded), there were no longer any ao2 ref leaks on Asterisk shutdown. Most of these are simply Asterisk not properly cleaning up after itself on shutdown; however, a few could arguably result in slow growing memory leaks, particularly in systems that used frequent reloads.
Still haven't found the channel ref leak, but this does remove a lot of error messages.
Note that while this patch is for trunk, a version should be applied to 1.8, 10, and 11 as well.
For Richard:
I noticed that some of the internally allocated nodes in astobj2 would not be represented in a REF_DEBUG log, as they never used a 'debug' version of ao2_alloc or ao2_ref. Unfortunately, a few code paths resulted in those same nodes showing up in the REF_DEBUG log, leading to warnings that nodes were appearing that were never allocated. This patch manages to get all of the nodes represented in a REF_DEBUG log; however, I imagine that for the red/black tree work, this is going to be compounded. If you have another approach you'd like to take other than what I have here, let me know.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">A whole lot of loading/unloading, changing configuration, and generally peeking through REF_DEBUG logs.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>/trunk/channels/chan_agent.c <span style="color: grey">(374095)</span></li>
<li>/trunk/include/asterisk/astobj2.h <span style="color: grey">(374095)</span></li>
<li>/trunk/main/asterisk.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/astobj2.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/ccss.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/cel.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/channel.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/config_options.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/data.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/db.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/event.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/features.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/format.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/format_pref.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/indications.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/manager.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/message.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/named_acl.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/pbx.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/taskprocessor.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/udptl.c <span style="color: grey">(374095)</span></li>
<li>/trunk/main/xmldoc.c <span style="color: grey">(374095)</span></li>
<li>/trunk/res/res_musiconhold.c <span style="color: grey">(374095)</span></li>
<li>/trunk/res/res_xmpp.c <span style="color: grey">(374095)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2137/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>