<br><br><div class="gmail_quote">On Wed, May 26, 2010 at 1:11 AM, Mark Michelson wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="im">
On 05/25/2010 08:18 AM, MohammedShehzad wrote:<br>
&gt;<br>
&gt; Hi all,<br>
&gt;<br>
&gt; My custom IVR application of asterisk records the voice of user.<br>
&gt; It sets the read format to sleaner using ast_set_read_format funciton<br>
&gt; on line number  2144.<br>
&gt;         flag = ast_set_read_format(chan, AST_FORMAT_SLINEAR);<br>
&gt; Which is leaving behind some leaks : below is the part of the trace of<br>
&gt; asterisk under run valgrind as below:<br>
&gt;<br>
&gt; ==11972==<br>
&gt; ==11972== 52,512 bytes in 3 blocks are definitely lost in loss record<br>
&gt; 115 of 117<br>
&gt; ==11972==    at 0x4A04B32: calloc (vg_replace_malloc.c:279)<br>
&gt; ==11972==    by 0x4A601D: newpvt (utils.h:359)<br>
&gt; ==11972==    by 0x4A714F: ast_translator_build_path (translate.c:288)<br>
&gt; ==11972==    by 0x438270: set_format (channel.c:2778)<br>
&gt; ==11972==    by 0x162A19A8: ??? (app_custom_ivr.c:2144)<br>
&gt; ==11972==    by 0x1629FB83: ??? (app_custom_ivr.c:1099)<br>
&gt; ==11972==    by 0x1629EB25: ??? (app_custom_ivr.c:525)<br>
&gt; ==11972==    by 0x47F21C: pbx_extension_helper (pbx.c:537)<br>
&gt; ==11972==    by 0x4814E0: __ast_pbx_run (pbx.c:2317)<br>
&gt; ==11972==    by 0x482158: pbx_thread (pbx.c:2634)<br>
&gt; ==11972==    by 0x4AB3EB: dummy_start (utils.c:865)<br>
&gt; ==11972==    by 0x376EC06616: start_thread (in<br>
</div>&gt; /lib64/<a href="http://libpthread-2.5.so" target="_blank">libpthread-2.5.so</a> &lt;<a href="http://libpthread-2.5.so" target="_blank">http://libpthread-2.5.so</a>&gt;)<br>
<div class="im">&gt; ==11972==    by 0x376E4D3C2C: clone (in /lib64/<a href="http://libc-2.5.so" target="_blank">libc-2.5.so</a><br>
</div>&gt; &lt;<a href="http://libc-2.5.so" target="_blank">http://libc-2.5.so</a>&gt;)<br>
<div class="im">&gt; ==11972==<br>
&gt;<br>
&gt; I do reset the read format back to old read format, but even though it<br>
&gt; is showing leaks.<br>
&gt;<br>
&gt; Any one can please let me know what i am missing in using<br>
&gt; ast_set_read_format function?<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt;<br>
&gt; -MohammedShehzad<br>
<br>
</div>ast_set_read_format will allocate memory if it needs to create a<br>
translation path. However, when you call ast_set_read_format, the old<br>
translation path on the channel will be freed first. Furthermore, when a<br>
channel is destroyed, the translation path is freed as well.<br>
<br>
When are you seeing this output from valgrind? Are you stopping Asterisk<br>
with channels still up? if that is the case, then it is not surprising<br>
to see that there is still memory allocated for translation paths.<br>
<font color="#888888"><br>
Mark Michelson<br>
</font><div><div></div><br></div></blockquote></div>I assume that there is no need to call any function to destroy the 
channel implicitly.<br>I get this output after making few calls which hits the custom IVR. Although I stop the asterisk only after making sure that no channel is active.<br><br>-- <br><br>-MohammedShehzad<br>