<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/1066/">https://reviewboard.asterisk.org/r/1066/</a>
     </td>
    </tr>
   </table>
   <br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.orgrb/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.</div>
<div>By Tilghman Lesher.</div>


<p style="color: grey;"><i>Updated 2011-01-24 04:42:38.452302</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;">Changed the patch as agreed on #asterisk-dev, by moving the embedded struct into a pointer and ensuring that the pointer is never dereferenced unless the structure has been allocated.</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;">Eight months ago, a fix went in to solve the problem of loading modules that were compiled with a different value of DEBUG_THREADS than the core Asterisk binary, which results in differences in the structure of a mutex.  Unfortunately, this did not take into account the size of the mutex structure, especially as it pertains to chan_iax2.  The result is that chan_iax2, starting with 1.8, now takes up 100MB of memory.  This is primarily due to the 3016 bytes used for each mutex, which is in each astobj2, and we allocate 32767 of them at boot, one for each possible IAX2 source number.  This patch changes the lock tracking from a builtin struct to a pointer, allocated only when tracking is active (typically when debugging).</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing (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;">Compiled both with and without DEBUG_THREADS, verified that the mutex is now much smaller, and Asterisk still functions correctly.</pre>
  </td>
 </tr>
</table>



<div style="margin-top: 1.5em;">
 <b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>


 <a href="https://issues.asterisk.org/view.php?id=18194">18194</a>


</div>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/branches/1.8/include/asterisk/lock.h <span style="color: grey">(303461)</span></li>

 <li>/branches/1.8/main/heap.c <span style="color: grey">(303461)</span></li>

 <li>/branches/1.8/main/lock.c <span style="color: grey">(303461)</span></li>

 <li>/branches/1.8/main/utils.c <span style="color: grey">(303461)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/1066/diff/" style="margin-left: 3em;">View Diff</a></p>




  </td>
 </tr>
</table>




  </div>
 </body>
</html>