[Spambayes] Problem with imap filter on mac os x: memory error

Tony Meyer tameyer at ihug.co.nz
Thu Jul 22 02:35:18 CEST 2004

> But when I try to run it as a filter, even by making the inbox
> much smaller (just a few hundred messages), I keep getting a memory
> allocation error. Any ideas on what is going wrong? No other 
> mail programs are running at the time.
> It's a Mac G5 running OS X 10.3
> % python sb_imapfilter.py -t -c -l 5 -P
> SpamBayes IMAP Filter Version 0.4 (May 2004)
> and engine SpamBayes Engine Version 0.3 (January 2004).
> Password: 
> *** malloc: vm_allocate(size=4890624) failed (error code=3)
> *** malloc[4452]: error: Can't allocate region
> MemoryError

I really don't like the look of those malloc errors.  It appears that it's
only asking for 4.89 MB of memory, which is not a lot really.  Googling for
this error code gives examples of people with the problem, but they're
typically asking for more than a GB of memory (at which point the error is
more understandable).

Is there plenty of free space on the drive that's being used for the swap?
Do any other programs have memory troubles?

Is there a fairly large message in the IMAP folders that it's scanning
through?  (perhaps something about 4.9 MB?)  Python's imaplib tries to
receive the whole message in one chunk, meaning (I presume) that the memory
is requested in one chunk, but if that's a problem then it's a Python
problem and I would have thought that some other OX X 10.3 Python user would
have hit it.  (The google results did have a few Perl hits, though).

Could you try this and see what happens?

% python
>>> import imaplib
>>> i = imaplib.IMAP4("my.mail.server")
>>> i.login("username", "password")
>>> i.select()
>>> i.fetch(1)
>>> i.logout()
>>> (control-z)

=Tony Meyer

Please always include the list (spambayes at python.org) in your replies
(reply-all), and please don't send me personal mail about SpamBayes. This
way, you get everyone's help, and avoid a lack of replies when I'm busy.

More information about the Spambayes mailing list