[issue1441530] socket read() can cause MemoryError in Windows
Charles-François Natali
report at bugs.python.org
Sat May 21 12:17:19 CEST 2011
Charles-François Natali <neologix at free.fr> added the comment:
It's actually an obvious case of heap fragmentation due to long-lived chunks being realloc()ed to a smaller size. Some malloc implementations can choke on this (e.g. OS-X's malloc is known to not shrink blocks when realloc() is called with a smaller size).
The solution is simply to use a StringIO to avoid holding references to those blocks for too long.
Patch attached.
----------
Added file: http://bugs.python.org/file22044/imaplib_read.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1441530>
_______________________________________
More information about the Python-bugs-list
mailing list