<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>
><br>
> Hi all,<br>
><br>
> My custom IVR application of asterisk records the voice of user.<br>
> It sets the read format to sleaner using ast_set_read_format funciton<br>
> on line number 2144.<br>
> flag = ast_set_read_format(chan, AST_FORMAT_SLINEAR);<br>
> Which is leaving behind some leaks : below is the part of the trace of<br>
> asterisk under run valgrind as below:<br>
><br>
> ==11972==<br>
> ==11972== 52,512 bytes in 3 blocks are definitely lost in loss record<br>
> 115 of 117<br>
> ==11972== at 0x4A04B32: calloc (vg_replace_malloc.c:279)<br>
> ==11972== by 0x4A601D: newpvt (utils.h:359)<br>
> ==11972== by 0x4A714F: ast_translator_build_path (translate.c:288)<br>
> ==11972== by 0x438270: set_format (channel.c:2778)<br>
> ==11972== by 0x162A19A8: ??? (app_custom_ivr.c:2144)<br>
> ==11972== by 0x1629FB83: ??? (app_custom_ivr.c:1099)<br>
> ==11972== by 0x1629EB25: ??? (app_custom_ivr.c:525)<br>
> ==11972== by 0x47F21C: pbx_extension_helper (pbx.c:537)<br>
> ==11972== by 0x4814E0: __ast_pbx_run (pbx.c:2317)<br>
> ==11972== by 0x482158: pbx_thread (pbx.c:2634)<br>
> ==11972== by 0x4AB3EB: dummy_start (utils.c:865)<br>
> ==11972== by 0x376EC06616: start_thread (in<br>
</div>> /lib64/<a href="http://libpthread-2.5.so" target="_blank">libpthread-2.5.so</a> <<a href="http://libpthread-2.5.so" target="_blank">http://libpthread-2.5.so</a>>)<br>
<div class="im">> ==11972== by 0x376E4D3C2C: clone (in /lib64/<a href="http://libc-2.5.so" target="_blank">libc-2.5.so</a><br>
</div>> <<a href="http://libc-2.5.so" target="_blank">http://libc-2.5.so</a>>)<br>
<div class="im">> ==11972==<br>
><br>
> I do reset the read format back to old read format, but even though it<br>
> is showing leaks.<br>
><br>
> Any one can please let me know what i am missing in using<br>
> ast_set_read_format function?<br>
><br>
><br>
> --<br>
><br>
> -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>