[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@xxxxxx>
  * 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
-- 
_______________________________________________
leafnode-list mailing list
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
http://www.dt.e-technik.uni-dortmund.de/mailman/listinfo/leafnode-list
http://leafnode.sourceforge.net/