Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Mail-Audit CPAN distribution.

Report information
The Basics
Id: 412
Status: resolved
Priority: 0/
Queue: Mail-Audit

People
Owner: Nobody in particular
Requestors: ndi-cpan [...] bumppo.net
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Mail::Audit memory leak
Line 183 in Mail::Audit, "$self->{obj} = $self;", creates a circular reference, a disaster for long-running processes churning through a lot of mail in a single perl invocation. I had never seen Mac OS X lock up from incapacitated VM before I ran into this (768MB RAM) Eliminating the circular reference also seems to resolve a persistent delay of many minutes that I experience after scripts process more than a couple thousand messages at a go, but which occurs only when parsing MIME. I don't fully understand that one yet, but the delay goes away with the elimination of the circular reference.
Date: Tue, 27 Aug 2002 15:03:09 -0700
From: Nathaniel Irons <ndi-cpan [...] bumppo.net>
Subject: Re: [cpan #412] Mail::Audit memory leak
To: bug-Mail-Audit [...] rt.cpan.org
I've got a handy bulkfilter plugin, but with this leak still in play, anyone filtering mail in the quantities for which the plugin was designed will probably run out of memory. Here's a pair of mutually exclusive patches to rectify the situation. First, a good-but-incompatible "leak_memory" constructor argument. This option enables storage of $self on demand, and disables it by default: 142,149d141 < The C<leak_memory> option, if set to a true value, provides < access to $self stored in $object->{obj}. This creates a < circular reference and prevents Mail::Audit objects from < freeing their memory until the entire program exits, which < can incapacitate a machine processing large quantities of < mail within a single perl invocation. Some people like it < anyway. < 191,192c183 < # access to $self, causes Mail::Audit objects to leak < $self->{obj} = $self if ($opts{'leak_memory'}); --- Show quoted text
> $self->{obj} = $self; # backwards-compatibility for everyone who desperately needed access to $self
Alternatively, here's a bad but compatible "no_leaks" constructor argument: 117,124d116 < Unless the C<no_leaks> option is set to a true value, Mail::Audit < objects will store $self in $object->{obj}. This incidentally < hides Mail::Audit objects from garbage collection, preventing < them from freeing their memory until perl exits. If you're < processing large quantities of mail from within a single perl < invocation, and your scripts are bringing the OS to its knees < with VM thrash, you probably forgot to set C<no_leaks>. < 191,192c183 < # backwards-compatibility for everyone who desperately needed access to $self < $self->{obj} = $self unless ($opts{'no_leaks'}); --- Show quoted text
> $self->{obj} = $self; # backwards-compatibility for everyone who desperately needed access to $self
I hope one of these is satisfactory, especially the first one. -nat
From: piotr
True, to me this has been very problematic, and recently I've found out. [ndi-cpan@bumppo.net - Tue Aug 27 18:03:14 2002]: Show quoted text
> I've got a handy bulkfilter plugin, but with this leak still in
play, Show quoted text
> anyone filtering mail in the quantities for which the plugin was > designed will probably run out of memory. Here's a pair of mutually > exclusive patches to rectify the situation. > > First, a good-but-incompatible "leak_memory" constructor argument. > This > option enables storage of $self on demand, and disables it by
default: Show quoted text
> > > 142,149d141 > < The C<leak_memory> option, if set to a true value, provides > < access to $self stored in $object->{obj}. This creates a > < circular reference and prevents Mail::Audit objects from > < freeing their memory until the entire program exits, which > < can incapacitate a machine processing large quantities of > < mail within a single perl invocation. Some people like it > < anyway. > < > 191,192c183 > < # access to $self, causes Mail::Audit objects to leak > < $self->{obj} = $self if ($opts{'leak_memory'}); > ---
> > $self->{obj} = $self; # backwards-compatibility for everyone
who Show quoted text
> desperately needed access to $self > > > Alternatively, here's a bad but compatible "no_leaks" constructor > argument: > > 117,124d116 > < Unless the C<no_leaks> option is set to a true value, Mail::Audit > < objects will store $self in $object->{obj}. This incidentally > < hides Mail::Audit objects from garbage collection, preventing > < them from freeing their memory until perl exits. If you're > < processing large quantities of mail from within a single perl > < invocation, and your scripts are bringing the OS to its knees > < with VM thrash, you probably forgot to set C<no_leaks>. > < > 191,192c183 > < # backwards-compatibility for everyone who desperately
needed Show quoted text
> access to $self > < $self->{obj} = $self unless ($opts{'no_leaks'}); > ---
> > $self->{obj} = $self; # backwards-compatibility for everyone
who Show quoted text
> desperately needed access to $self > > I hope one of these is satisfactory, especially the first one. > > -nat
This seems to have already been resolved. -- rjbs