[Mimedefang] Memory problems

Martin Blapp mb at imp.ch
Mon Oct 25 19:48:10 EDT 2004


Hi,

Depending how many rules you use you'll need this
spamassassin patch for some mails which have many
newlines ...

--- lib/Mail/SpamAssassin/Message.pm	Thu Sep  9 20:29:19 2004
+++ lib/Mail/SpamAssassin/Message.pm	Thu Sep 16 12:50:54 2004
@@ -197,10 +197,12 @@
   # will get modified below
   $self->{'pristine_body'} = join('', @message);

-  # CRLF -> LF
-  for ( @message ) {
-    s/\r\n/\n/;
-  }
+  # Remove repeated empty lines and convert CRLF to LF
+  # This saves us a lot of mem.
+  my $tmpmsg = join('', $self->{'pristine_body'});
+  $tmpmsg =~ s/\r\n/\n/gs;
+  $tmpmsg =~ s/\n{100,}/\n/gs;
+  @message = split ( /^/m, $tmpmsg );

   # If the message does need to get parsed, save off a copy of the body
   # in a format we can easily parse later so we don't have to rip from

--
Martin

Martin Blapp, <mb at imp.ch> <mbr at FreeBSD.org>
------------------------------------------------------------------
ImproWare AG, UNIXSP & ISP, Zurlindenstrasse 29, 4133 Pratteln, CH
Phone: +41 61 826 93 00 Fax: +41 61 826 93 01
PGP: <finger -l mbr at freebsd.org>
PGP Fingerprint: B434 53FC C87C FE7B 0A18 B84C 8686 EF22 D300 551E
------------------------------------------------------------------




More information about the MIMEDefang mailing list