stream.data must be freed, in that case i think its being converted to char by assigning sql to point at it but it is still freed in the end, that type of mistake would be all over the place in valgrind.<br><br>look for a pool that is being reused over and over and never destroyed.<br>
<br><br><br><div class="gmail_quote">On Mon, Apr 19, 2010 at 1:25 PM, Sergey Okhapkin <span dir="ltr">&lt;<a href="mailto:sos@sokhapkin.dyndns.org">sos@sokhapkin.dyndns.org</a>&gt;</span> 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 style="font-family: &#39;Sans Serif&#39;; font-size: 10pt; font-weight: 400; font-style: normal;">
<p style="margin: 0px; text-indent: 0px;">Yes, I agree that these strdups can be ignored. I believe I found where the memory problem comes from, the beginning of bill_event function in mod_nubblebill has</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">SWITCH_STANDARD_STREAM(sql_stream);</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">But SWITCH_STANDARD_STREAM macro does malloc! I do not see a place in the function where the memory is freed. Am I right?</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">#define SWITCH_STANDARD_STREAM(s) memset(&amp;s, 0, sizeof(s)); s.data = <span style="font-weight: 600;">malloc(SWITCH_CMD_CHUNK_LEN)</span>; \</p>
<p style="margin: 0px; text-indent: 0px;">        switch_assert(s.data);                                                                                          \</p>
<p style="margin: 0px; text-indent: 0px;">        memset(s.data, 0, SWITCH_CMD_CHUNK_LEN);                                                        \</p>
<p style="margin: 0px; text-indent: 0px;">        s.end = s.data;                                                                                                         \</p>
<p style="margin: 0px; text-indent: 0px;">        s.data_size = SWITCH_CMD_CHUNK_LEN;                                                                     \</p>
<p style="margin: 0px; text-indent: 0px;">        s.write_function = switch_console_stream_write;                                         \</p>
<p style="margin: 0px; text-indent: 0px;">        s.raw_write_function = switch_console_stream_raw_write;                         \</p>
<p style="margin: 0px; text-indent: 0px;">        s.alloc_len = SWITCH_CMD_CHUNK_LEN;                                                                     \</p>
<p style="margin: 0px; text-indent: 0px;">        s.alloc_chunk = SWITCH_CMD_CHUNK_LEN</p><div><div></div><div class="h5">
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">On Monday 19 April 2010, Rupa Schomaker wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; Those strdups are probably easily fixed.  But...  THey are just in the</p>
<p style="margin: 0px; text-indent: 0px;">&gt; module load, not as part of the module runtime.  So it is a one-time leak</p>
<p style="margin: 0px; text-indent: 0px;">&gt; not a per-call or per-nibble leak.</p>
<p style="margin: 0px; text-indent: 0px;">&gt; </p>
<p style="margin: 0px; text-indent: 0px;">&gt; On Mon, Apr 19, 2010 at 12:48 PM, Sergey Okhapkin</p>
<p style="margin: 0px; text-indent: 0px;">&gt; </p>
<p style="margin: 0px; text-indent: 0px;">&gt; &lt;<a href="mailto:sos@sokhapkin.dyndns.org" target="_blank">sos@sokhapkin.dyndns.org</a>&gt;wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; Few unimportant records only:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 7 bytes in 1 blocks are still reachable in loss record 21 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BECC00: mod_nibblebill_load (mod_nibblebill.c:132)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 7 bytes in 1 blocks are still reachable in loss record 22 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BECD14: mod_nibblebill_load (mod_nibblebill.c:134)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 7 bytes in 1 blocks are still reachable in loss record 23 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BECACC: mod_nibblebill_load (mod_nibblebill.c:128)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 8 bytes in 1 blocks are still reachable in loss record 28 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BEC9FB: mod_nibblebill_load (mod_nibblebill.c:127)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 9 bytes in 1 blocks are still reachable in loss record 30 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BECB19: mod_nibblebill_load (mod_nibblebill.c:129)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 10 bytes in 1 blocks are still reachable in loss record 34 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BECC8A: mod_nibblebill_load (mod_nibblebill.c:133)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 10 bytes in 1 blocks are still reachable in loss record 35 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BEC5D6: mod_nibblebill_load (mod_nibblebill.c:125)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476== 14 bytes in 1 blocks are still reachable in loss record 45 of</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; 141 ==12476==    at 0x4026378: malloc (in /usr/lib/valgrind/x86-</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; linux/vgpreload_memcheck.so)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x457B6CF: strdup (in /lib/<a href="http://libc-2.10.1.so" target="_blank">libc-2.10.1.so</a>)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; ==12476==    by 0x7BEC54D: mod_nibblebill_load (mod_nibblebill.c:124)</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; On Monday 19 April 2010, Anthony Minessale wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; and did anything in the valgrind report even mention nibblebill?</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; you only sent the tiny excerpt.</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; On Mon, Apr 19, 2010 at 12:27 PM, Sergey Okhapkin</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &lt;<a href="mailto:sos@sokhapkin.dyndns.org" target="_blank">sos@sokhapkin.dyndns.org</a>&gt;wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; Anyway it&#39;s offtopic already:-) The thread was about unbounded memory</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; grows with enabled mod_nibblebill. On relatively busy server memory</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; stays</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; at about</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; 100M RSS for weeks if mod_nibblebill is not used, but grows to 800M</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; in one day</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; if nibbling is enabled.</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; On Monday 19 April 2010, Brian West wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; That still doesn&#39;t mean the dialogs were properly cleared by the</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; sip</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; stack</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;  before shutdown.  That is what anthony is getting at.  Valgrind</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; does</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; make</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;  mistakes at times about what is leaking in cases like this.</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; /b</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; On Apr 19, 2010, at 12:06 PM, Sergey Okhapkin wrote:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; &gt; Yes, I stopped the traffic to the server and issued hupall CLI</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; &gt; command before shutting down FS.</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; _______________________________________________</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; FreeSWITCH-users mailing list</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></p>

<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt; UNSUBSCRIBE:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; <a href="http://lists.freeswitch.org/mailman/options/freeswitch-user" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-user</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; &gt;s <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; _______________________________________________</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; FreeSWITCH-users mailing list</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; UNSUBSCRIBE:</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; <a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; &gt; &gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt;</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; _______________________________________________</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; FreeSWITCH-users mailing list</p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; &gt; <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a></p>
<p style="margin: 0px; text-indent: 0px;">&gt; </p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;"></p></div></div></div><br>_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900<br>