Re: Memory usage
Mark Overmeer <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Organization | MARKOV Solutions |
| Message-ID | <[email protected]> |
* Daniel P. Berrange ([email protected]) [040317 18:57]: > On Wed, Mar 17, 2004 at 05:50:21PM +0000, Daniel P. Berrange wrote: > This identified a circular reference that being held by the > Mail::Box::File in the 'MBF_create_options' attribute > sub messageCreateOptions(@) > { > my $self = shift; > $self->{MBF_create_options} = [ @_ ] if @_; > if (@_) { > foreach (@{$self->{MBF_create_options}}) { > if (ref($_)) { > weaken $_; > } > } > } > } Probably, the reference is via the manager object, but I'm not sure. I do know that the reference usually isn't present, because I have that in the test scripts. I have changed it a little more careful into: sub messageCreateOptions(@) { my ($self, @options) = @_; if(@options) { ref($_) && ref($_) =~ m/^Mail::/ && weaken $_ for @options; $self->{MBF_create_options} = \@options; } @{$self->{MBF_create_options}}; } Is that correct, you think? > Encode::compat seems to be the culprit of the huge memory usage - it > gets castastrophically worse as the size of the string being decoded > increases. I changed from calling > my $decoded = decode($charset, $part->body); > to > my $decoded = join('', map { decode($charset, $_) } $part->lines); > And its now behaving reasonably. Have you reported this to that author? Before I modify this in MailBox, I would like to know whether this will get fixed at the source... -- MarkOv ------------------------------------------------------------------------ drs Mark A.C.J. Overmeer MARKOV Solutions [email protected] [email protected] http://Mark.Overmeer.net http://solutions.overmeer.net