[leafnode-list] Re: Memory leak (Was: Limiting leafnode run time and/or memory usage?)

Matthias Andree matthias.andree at gmx.de
Mon Dec 27 20:05:15 CET 2004


On Sun, 26 Dec 2004, Lloyd Zusman wrote:

> There appears to be a significant memory leak in leafnode-20041215a.
> 
> I'm running this in a local-group-only configuration.  Every time I
> issue a "group local.newsgroup" command from within an nntp session,
> the leafnode process grabs around 320,000 bytes of memory that it
> never releases. This is consistent: each and every time I issue that
> command, the memory footprint of the leafnode process increases by
> this amount.  This has continued all the way up to 256 meg.

Right. This patch (from DARCS) should fix the problem:

Mon Dec 27 20:03:20 CET 2004  Matthias Andree <matthias.andree at gmx.de>
  * fix xgetxover() memory leak
diff -rN -u leafnode-2-darcs-old/NEWS leafnode-2-darcs-new/NEWS
--- leafnode-2-darcs-old/NEWS	2004-12-27 20:04:02.000000000 +0100
+++ leafnode-2-darcs-new/NEWS	2004-12-27 20:03:15.000000000 +0100
@@ -2,6 +2,10 @@
 * Valgrind-2.1.X will interfere with writeactive, break fchmod. Use 2.0.
 * The code sometimes uses timeout_client where it should use a server timeout.
 |
+Changes since 20041215a:
+- Bugfix: Fix massive memory leak in "GROUP" command and other commands
+  that read the overview data. Reported by Lloyd Zusman.
+
 20041215a: Changes since 20041213a:
 - Feature: when a fresh post matches a filter, reject the post.
 
diff -rN -u leafnode-2-darcs-old/xoverutil.c leafnode-2-darcs-new/xoverutil.c
--- leafnode-2-darcs-old/xoverutil.c	2004-12-27 20:04:02.000000000 +0100
+++ leafnode-2-darcs-new/xoverutil.c	2004-12-27 20:01:46.000000000 +0100
@@ -413,8 +413,10 @@
 
     if (fixxover) {
 	dl = dirlist(".", DIRLIST_ALLNUM, &xcount);
-	if (!dl)
+	if (!dl) {
+	    free(overview);
 	    return 0;
+	}
 
 	/* find article range on disk, store into xcount */
 	/* FIXME: don't choke on numeric subgroups */
@@ -467,6 +469,7 @@
 	xcount = current;		/* to prevent findxover from choking */
 	if (g)
 	    g->count = current;
+	free(overview);
 	return 1;
     }
 
@@ -561,6 +564,7 @@
 	g->count = current;
     }
 
+    free(overview);
     return 1;
 }
 
-- 
Matthias Andree



More information about the leafnode-list mailing list