Nik Conwell writes: > >I have a daemon that essentially does: > >$spamtest = Mail::SpamAssassin->new; > >while() { > $mail = Mail::SpamAssassin::NoMailAudit->new( nomime => 1, data => [EMAIL > PROTECTED]); > $status = $spamtest->check($mail); > $status->finish(); >} > > >and I've found that it continually consumes memory. I can send a 20 line sample >program if it's instructive. > >Is there something else I should be doing to clean up between iterations, or is >this a bug? I've RTFM, but maybe I'm missing something. The stuff in the while >is actually in a subroutine so garbage should be collected on each iteration. >Also, undefing spamtest every N iterations actually makes it consume memory even >more!
It is leaking memory -- we haven't had time to check it out. Basically, perl's not good with circular references, where you have a Mail::SpamAssassin object creating Mail::SpamAssassin::PerMsgStatus, which often have a reference to Mail::SpamAssassin somewhere in there; these refs need to be deleted from finish() by hand, instead of relying on the perl GC. We have quite a few deleted, but there's more we've probably missed. Also there are perl bugs in the GC resulting in leaked memory even when all the circular refs are fixed. Because spamd is the general use-case, which forks, we haven't had to clean it up yet ;) --j. ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here: http://www.vmware.com/wl/offer/345/0 _______________________________________________ Spamassassin-talk mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/spamassassin-talk