473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

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

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
Jul 18 '05 #1
0 1309

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wilfredo Sanchez | last post by:
The docs for imaplib are pretty scant, and i guess the library is meant for people who already know IMAP well and want low-level access to the protocol, as opposed to someone who wants "get me the...
2
by: Sean Dodsworth | last post by:
Can anyone tell me how to get a message's number from the message-id using IMAP4.search? I've tried this: resp, items = server.search(None, 'HEADER', '"Message-id"', msgID) but it gives me a...
2
by: Xah Lee | last post by:
Python Doc Problem Example: os.system Xah Lee, 2005-09 today i'm trying to use Python to call shell commands. e.g. in Perl something like output=qx(ls) in Python i quickly located the...
25
by: Xah Lee | last post by:
Python Doc Problem Example: gzip Xah Lee, 20050831 Today i need to use Python to compress/decompress gzip files. Since i've read the official Python tutorial 8 months ago, have spent 30...
4
by: WATYF1 | last post by:
Hello. I'm writing a VB.NET app to check email message counts for both POP3 and IMAP4. I'm using TCPClient to connect, and a NetworkStream to send simple commands. It's a very simple bit of code,...
7
by: Dody Suria Wijaya | last post by:
Hi, I encountered a Memory Error Exception on using IMAP4 just like in Python documentation example, on a specially large email (10 MB). Any idea how to fix/circumvent this? >>> typ, data =...
0
by: Luis Corrales | last post by:
Hi all, I have a problem when searching for text with special characters in e-mails in an IMAP server. I'm using imaplib in python 2.4.3 and I can't get this code working: # first connect and...
0
by: Laszlo Nagy | last post by:
Hi, I'm using imaplib to access an IMAP4 server. I'm reading the IMAP4 specification, and I found something odd. The search command can be used in conjuction with date values. For example, I...
3
by: writser | last post by:
hey all, For my study I'm writing a simple threaded webcrawler and I am trying to do this in python. But somehow, using threads causes IDLE to crash on Windows XP (with the latest python...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.