Ok, looks like it's still leaking. I haven't used valgrind before, but here is the output with leak-check=full:<br><br>==27470==<br>==27470== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 42 from 1)<br>==27470== malloc/free: in use at exit: 464,868 bytes in 22,518 blocks.<br>
==27470== malloc/free: 939,731 allocs, 917,213 frees, 30,806,969 bytes allocated.<br>==27470== For counts of detected errors, rerun with: -v<br>==27470== searching for pointers to 22,518 not-freed blocks.<br>==27470== checked 690,580 bytes.<br>
==27470==<br>==27470== 1,488 bytes in 6 blocks are possibly lost in loss record 4 of 13<br>==27470== at 0x40045C0: memalign (vg_replace_malloc.c:332)<br>==27470== by 0x400461A: posix_memalign (vg_replace_malloc.c:425)<br>
==27470== by 0x4DDAC4: (within /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4DE4FE: g_slice_alloc (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4A9CA8: g_array_sized_new (in /lib/libglib-2.0.so.0.1200.3)<br>
==27470== by 0x4A9DB6: g_array_new (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4E58E6: g_static_private_set (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4EC04D: g_get_charset (in /lib/libglib-2.0.so.0.1200.3)<br>
==27470== by 0x4B2B1A: g_locale_to_utf8 (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4D35CC: (within /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4D3F02: (within /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4D4461: g_option_context_parse (in /lib/libglib-2.0.so.0.1200.3)<br>
==27470==<br>==27470==<br>==27470== 2,040 bytes in 1 blocks are definitely lost in loss record 6 of 13<br>==27470== at 0x40046FF: calloc (vg_replace_malloc.c:279)<br>==27470== by 0x4CE57D: g_malloc0 (in /lib/libglib-2.0.so.0.1200.3)<br>
==27470== by 0x4DE2F7: g_slice_alloc (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4C4FDA: g_list_append (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4D33BC: g_option_context_add_group (in /lib/libglib-2.0.so.0.1200.3)<br>
==27470== by 0x8066F44: g_process_add_option_group (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x804E15D: main (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470==<br>==27470==<br>==27470== 19,854 (18,775 direct, 1,079 indirect) bytes in 18,684 blocks are definitely lost in loss record 11 of 13<br>
==27470== at 0x40053C0: malloc (vg_replace_malloc.c:149)<br>==27470== by 0x4CE615: g_malloc (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x4E06A0: g_strndup (in /lib/libglib-2.0.so.0.1200.3)<br>==27470== by 0x807D30B: r_find_node (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>
==27470== by 0x807D0F8: r_find_node (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x807D258: r_find_node (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x807D0F8: r_find_node (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>
==27470== by 0x807AA5F: log_pattern_database_lookup (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x8062C0C: log_db_parser_process (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x8061D8E: log_parser_process (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>
==27470== by 0x8062D70: log_parser_rule_process (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470== by 0x8062F4D: log_process_rule_process (in /usr/local/syslog-ng-3.0-git/sbin/syslog-ng)<br>==27470==<br>==27470== LEAK SUMMARY:<br>
==27470== definitely lost: 20,815 bytes in 18,685 blocks.<br>==27470== indirectly lost: 1,079 bytes in 22 blocks.<br>==27470== possibly lost: 1,488 bytes in 6 blocks.<br>==27470== still reachable: 441,486 bytes in 3,805 blocks.<br>
==27470== suppressed: 0 bytes in 0 blocks.<br>==27470== Reachable blocks (those to which a pointer was found) are not shown.<br>==27470== To see them, rerun with: --show-reachable=yes<br><br>Hopefully this helps!<br>
<br>--Martin<br><br><div class="gmail_quote">On Fri, Apr 24, 2009 at 1:29 PM, Martin Holste <span dir="ltr"><<a href="mailto:mcholste@gmail.com">mcholste@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Wow! That was quick! I'm running the new code now, but it will take a few hours to see if the memory grows too large. Thanks for the quick commit.<br><font color="#888888"><br>--Martin</font><div><div></div><div class="h5">
<br><br><div class="gmail_quote">On Fri, Apr 24, 2009 at 12:29 PM, ILLES, Marton <span dir="ltr"><<a href="mailto:illes.marton@balabit.hu" target="_blank">illes.marton@balabit.hu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>On Fri, 2009-04-24 at 18:28 +0200, ILLES, Marton wrote:<br>
> On Fri, 2009-04-24 at 10:29 -0500, Martin Holste wrote:<br>
> > I'm running tests with the db-parser() parser module and finding that<br>
> > the memory grows exponentially until the program finally dies with:<br>
> ><br>
> > ***MEMORY-ERROR***: syslog-ng[2769]: GSlice: failed to allocate 248<br>
> > bytes (alignment: 256): Cannot allocate memory<br>
> ><br>
><br>
> snip<br>
><br>
> > Should I recompile with memtrace on?<br>
> ><br>
><br>
> Running it in valgrind would be even more useful also enabling core<br>
> might help as well.<br>
><br>
> M<br>
<br>
</div>I think I have got it:<br>
<br>
commit 778cb9b27366425153a6141d4966a1a464e97e79<br>
Author: Marton Illes <<a href="mailto:marci@balabit.hu" target="_blank">marci@balabit.hu</a>><br>
Date: Fri Apr 24 19:24:40 2009 +0200<br>
<br>
fixed a memory leak in db-parser() dynamic value handling<br>
<br>
Reported by: Martin Holste<br>
<br>
diff --git a/src/logpatterns.c b/src/logpatterns.c<br>
index f1012eb..fda9088 100644<br>
--- a/src/logpatterns.c<br>
+++ b/src/logpatterns.c<br>
@@ -312,6 +312,7 @@ log_pattern_database_lookup(LogPatternDatabase<br>
*self, LogMessage *msg)<br>
*/<br>
<br>
g_ptr_array_free(match_names, TRUE);<br>
+ g_array_free(matches, FALSE);<br>
return ((LogDBResult *) msg_node->value);<br>
}<br>
g_ptr_array_free(match_names, TRUE);<br>
<br>
Also in my git tree, please give it a try.<br>
<a href="http://git.balabit.hu/?p=marci/syslog-ng-3.0.git;a=commit;h=778cb9b27366425153a6141d4966a1a464e97e79" target="_blank">http://git.balabit.hu/?p=marci/syslog-ng-3.0.git;a=commit;h=778cb9b27366425153a6141d4966a1a464e97e79</a><br>
<br>
<br>
best,<br>
<font color="#888888"><br>
Marton<br>
</font><div><div></div><div>--<br>
Key fingerprint = F78C 25CA 5F88 6FAF EA21 779D 3279 9F9E 1155 670D<br>
<br>
<br>
______________________________________________________________________________<br>
Member info: <a href="https://lists.balabit.hu/mailman/listinfo/syslog-ng" target="_blank">https://lists.balabit.hu/mailman/listinfo/syslog-ng</a><br>
Documentation: <a href="http://www.balabit.com/support/documentation/?product=syslog-ng" target="_blank">http://www.balabit.com/support/documentation/?product=syslog-ng</a><br>
FAQ: <a href="http://www.campin.net/syslog-ng/faq.html" target="_blank">http://www.campin.net/syslog-ng/faq.html</a><br>
<br>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br>