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

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



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