fixed memory leaks [was: bogofilter-cvs ...]

David Relson relson at osagesoftware.com
Sat Mar 29 22:35:53 CET 2003


At 03:06 PM 3/29/03, Matthias Andree wrote:

>relson at users.sourceforge.net writes:
>
> > Update of /cvsroot/bogofilter/bogofilter/src
> > In directory sc8-pr-cvs1:/tmp/cvs-serv14497
> >
> > Modified Files:
> >       main.c mime.c rstats.c rstats.h
> > Log Message:
> > Fix memory leaks in classification.
>
>Have these fixes had a noticable impact on the memory use at run-time or
>are these just "to do things right" fixes?


Matthias,

Dan Deward had reported a couple of memory leaks.  While investigating 
them, I decided that bogofilter should release _everything_ it used.  I 
have a debug version of the xmalloc* routines that tracks current, maximum, 
and total bytes of memory usage as well as counts for mallocs (including 
calloc and realloc) and frees and reports the results.  Since I was working 
on malloc/free errors, I decided that the job would be done when all tests 
reported "cur_malloc = 0".  That result was achieved.

Is there a noticeable difference?  Not really.  If I recall, registering 
large mailboxes before my fixes might show a maximum usage of several 
MB.  After fixes, the max was under 1 MB.  There was a time several months 
back when "top" indicated a memory size of 300MB+ for a registration run, 
but I've never reproduced that.

If you're interested in the usage tracking code, I can post it.

David






More information about the bogofilter-dev mailing list