This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author effbot
Date 2005-12-23.18:11:10
SpamBayes Score
Marked as misclassified
When fetching large documents via SSL, the imaplib 
attempts to read it all in one chunk, but the SSL 
socket layer only returns ~16k at a time.

The result is that Python will end up allocating, say, 
a 15 megabyte block, shrink it to a few kilobytes, 
occasionally allocate a medium-sized block (to hold 
the list of chunks), and repeat this again and again 
and again.  Not all malloc implementations can reuse 
the (15 megabytes minus a few kilobyte) block when 
allocating the next 15 megabyte block.  In a worst 
case scenario, you'll need some 13 gigabytes of 
virtual memory to read a 15 megabyte message...

A simple solution is to change

    data =


    data =, 16384))

For more on this, see this thread:

Date User Action Args
2008-01-20 09:58:22adminlinkissue1389051 messages
2008-01-20 09:58:22admincreate