You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by pa...@apache.org on 2004/10/06 18:51:41 UTC

svn commit: rev 53886 - spamassassin/trunk/lib/Mail/SpamAssassin

Author: parker
Date: Wed Oct  6 09:51:39 2004
New Revision: 53886

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
Log:
Bug 3875: Use of map/grep/sha1 contruct causes large memory bloat, switch to simple foreach loop

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Bayes.pm	Wed Oct  6 09:51:39 2004
@@ -355,7 +355,11 @@
 
   # Go ahead and uniq the array, skip null tokens (can happen sometimes)
   # generate an SHA1 hash and take the lower 40 bits as our token
-  my %tokens = map { substr(sha1($_), -5) => { 'raw_token' => $_ } } grep(length, @tokens);
+  my %tokens;
+  foreach my $token (@tokens) {
+    next unless length($token); # skip 0 length tokens
+    $tokens{substr(sha1($token), -5)} = { 'raw_token' => $token };
+  }
 
   # return the keys == tokens ...
   return \%tokens;

Re: svn commit: rev 53886 - spamassassin/trunk/lib/Mail/SpamAssassin

Posted by Daniel Quinlan <qu...@pathname.com>.
parker@apache.org writes:

> Bug 3875: Use of map/grep/sha1 contruct causes large memory bloat, switch to simple foreach loop

I'd be +1 on including this in 3.0.1.  I think the bloat is bad news.

Daniel

-- 
Daniel Quinlan                     ApacheCon! 13-17 November (3 SpamAssassin
http://www.pathname.com/~quinlan/  http://www.apachecon.com/  sessions & more)

Re: svn commit: rev 53886 - spamassassin/trunk/lib/Mail/SpamAssassin

Posted by Daniel Quinlan <qu...@pathname.com>.
parker@apache.org writes:

> Bug 3875: Use of map/grep/sha1 contruct causes large memory bloat, switch to simple foreach loop

I'd be +1 on including this in 3.0.1.  I think the bloat is bad news.

Daniel

-- 
Daniel Quinlan                     ApacheCon! 13-17 November (3 SpamAssassin
http://www.pathname.com/~quinlan/  http://www.apachecon.com/  sessions & more)