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

Lloyd Zusman ljz at asfast.com
Mon Dec 27 23:46:37 CET 2004


On Mon, Dec 27, 2004 at 05:32:05PM -0500, Lloyd Zusman wrote:
> On Mon, Dec 27, 2004 at 08:05:15PM +0100, Matthias Andree wrote:
> > On Sun, 26 Dec 2004, Lloyd Zusman wrote:
> > 
> > > There appears to be a significant memory leak in leafnode-20041215a.
> > > 
> > > [ ... ]
> > 
> > Right. This patch (from DARCS) should fix the problem:
> >
> > [ ... ]
> 
> [ ... ]
>
> Apply the following patch AFTER applying the one that fixes the 
> memory leak:

Actually, there were a couple more places in the patch that needed
to be cleaned up: "free" was called on the "overview" variable in
places where it might be NULL. Therefore, I recommend the following
patch instead of the two we've been discussing (in other words,
apply this single patch instead of one that Matthias posted and
instead of my previous one):


*** xoverutil.c.orig    Mon Dec 27 17:35:01 2004
--- xoverutil.c Mon Dec 27 17:40:15 2004
***************
*** 413,420 ****
  
      if (fixxover) {
        dl = dirlist(".", DIRLIST_ALLNUM, &xcount);
!       if (!dl)
            return 0;
  
        /* find article range on disk, store into xcount */
        /* FIXME: don't choke on numeric subgroups */
--- 413,424 ----
  
      if (fixxover) {
        dl = dirlist(".", DIRLIST_ALLNUM, &xcount);
!       if (!dl) {
!           if (overview) {
!               free(overview);
!           }
            return 0;
+       }
  
        /* find article range on disk, store into xcount */
        /* FIXME: don't choke on numeric subgroups */
***************
*** 467,472 ****
--- 471,479 ----
        xcount = current;               /* to prevent findxover from choking */
        if (g)
            g->count = current;
+       if (overview) {
+           free(overview);
+       }
        return 1;
      }

-- 
 Lloyd Zusman
 ljz at asfast.com
 God bless you.



More information about the leafnode-list mailing list