IMAP4 example in docs causes memory error for me (OS X 10.3, python 2.3) - help?

J

John Owens

I am running the IMAP4 example in the documentation:

http://www.python.org/doc/lib/imap4-example.html

with two small changes (different username, comment out print
statement). The inbox I am accessing is 42 MB and has 80-someodd
messages, so the messages are fairly big (all of them have
attachments). When I run this program, I get a malloc error. Now, I'm
really new to python programming, but it was my understanding that
memory management was not something I had to explicitly do. I'd
appreciate some help in understanding what I've done wrong.

If I watch memory usage via "top", the memory usage (vmem) goes up to
3.5 GB, drops back down to a few tens of megabytes, then rises to 3.5
GB or so again, then crashes. (Backtrace is appended at the end of
this message.) It seems odd to me that python should require GB of
memory to read a 40 MB mailbox.

I also installed python 2.3.3 via fink and was able to reproduce the
error in the same way.

Machine / python information:

[JDO:~/Documents/src/vm2imap] jowens% uname -a
Darwin JDO.local 7.5.0 Darwin Kernel Version 7.5.0: Thu Aug 5
19:26:16 PDT 2004; root:xnu/xnu-517.7.21.obj~3/RELEASE_PPC Power
Macintosh powerpc
[JDO:~/Documents/src/vm2imap] jowens% python -V
Python 2.3.3

JDO

==

*** malloc: vm_allocate(size=7426048) failed (error code=3)
*** malloc[17319]: error: Can't allocate region
Traceback (most recent call last):
File "minimal.py", line 8, in ?
typ, data = M.fetch(num, '(RFC822)')
File "/sw/lib/python2.3/imaplib.py", line 417, in fetch
typ, dat = self._simple_command(name, message_set, message_parts)
File "/sw/lib/python2.3/imaplib.py", line 1000, in _simple_command
return self._command_complete(name, self._command(name, *args))
File "/sw/lib/python2.3/imaplib.py", line 830, in _command_complete
typ, data = self._get_tagged_response(tag)
File "/sw/lib/python2.3/imaplib.py", line 931, in
_get_tagged_response
self._get_response()
File "/sw/lib/python2.3/imaplib.py", line 893, in _get_response
data = self.read(size)
File "/sw/lib/python2.3/imaplib.py", line 231, in read
return self.file.read(size)
File "/sw/lib/python2.3/socket.py", line 301, in read
data = self._sock.recv(recv_size)
MemoryError
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top