[Pythonmac-SIG] malloc error with imaplib or socket on OS X

Bob Ippolito bob at redivi.com
Tue Mar 1 17:06:58 CET 2005

On Mar 1, 2005, at 10:54 AM, John P Speno wrote:

> On Tue, Mar 01, 2005 at 02:01:29PM +0000, Chris Miles wrote:
>> The data that was causing the MemoryError was a 9 MB mail message on
>> the IMAP server.  After I deleted this message the program on the Mac
>> ran fine.  The other messages were max 1 MB in size and there were
>> about 114 of them.  (The program downloads every message from a user's
>> IMAP account, amongst other things.)
> Are you perhaps running into a resource limit for the user who is 
> running the applicaiton?
> By default, OS X has pretty low limits:
> % limit
> cputime         unlimited
> filesize        unlimited
> datasize        6144 kbytes
> stacksize       8192 kbytes
> coredumpsize    0 kbytes
> memoryuse       unlimited
> descriptors     256
> memorylocked    unlimited
> maxproc         100
> Try raising the datasize limit. In tcsh, that's as simple as saying 
> 'unlimit'.
> In sh variants, you need some specific flags.

Bumping up against a resource limit would cause a very different error. 
  This bug is caused by the fact that realloc on Darwin never actually 
relinquishes any memory when shrinking an allocation, and Python 
expects it to.  In this case, there is/was some gnarly code in the 
socket module that is really optimistic about realloc's behavior.



More information about the Pythonmac-SIG mailing list