More info on leaks - after chasing a ton of ghosts, I am able to run clean
except for 1 problem if I add a weaken call to Part::container() as well as
init(). There is also a similar use of MMP_container in coerce(), though I'm
not positive it is required. The leaks that I though were left in my test
code seem to be a problem with the leak detector and how it interacts with
Mail::Message. In my case if I added a second msg->build primer before doing
leak detection, the leaks disappear. However, my very large daemon code runs
clean with the workaround below
My current problem is that $msg->lines()(and string()) leaks for simple text
and multiparts. I know this makes little sense, and I can't see anything
wrong, but I have tried a wide range of msgs and different code and it all
seems to leak. I wrote a very fast IO::Scalar replacement that I am using to
work around the problem for my simple use case, but it would be nice if
anyone could verify the same problem w/ their code
Thanks,
Todd
----- Original Message -----
From: "Wiggins d'Anconia" <wiggins@xxxxxxxxxxxx>
To: "Mark Overmeer" <Mark@xxxxxxxxxxxx>
Cc: "Mail-Box Mailinglist" <mailbox@xxxxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, May 19, 2003 8:46 PM
Subject: Re: large memory leak for multipart msgs
> Mark Overmeer wrote:
> > * wiggins@xxxxxxxxxxxx (wiggins@xxxxxxxxxxxx) [030516 16:11]:
> >
> >>>I am trying to track down a large memory leak in multipart msgs due to
a
> >>>circular reference.
> >>
> >>The good news is our app will eventually run these one to a process
> >>rather than in a loop so the memory leak isn't a large concern for us,
> >>but I think I can confirm it.
> >
> >
> > Can anyone confirm that the problem disappears when modifying
> > Mail/Message/Part,pm with:
> >
> > + use Scalar::Util 'weaken';
> >
> > sub init($)
> > { my ($self, $args) = @_;
> > $args->{head} ||= Mail::Message::Head::Complete->new;
> >
> > $self->SUPER::init($args);
> >
> > confess "No container specified for part.\n"
> > unless exists $args->{container};
> >
> > $self->{MMP_container} = $args->{container};
> > + weaken( $self->{MMP_container} );
> >
> > $self;
> > }
> >
> > I have to go out for a few hours, but will check on it later. This is
> > my first guess.
>
> The patch seems to have helped by about 15-20%. Sorry I can't give you
> more precise numbers. This was on a run of about 40K messages.
>
> http://danconia.org
>
>
>
|