[ python-Bugs-1296004 ] MemoryError in httplib

SourceForge.net noreply at sourceforge.net
Tue Sep 20 07:14:26 CEST 2005


Bugs item #1296004, was opened at 2005-09-20 05:14
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1296004&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Yue Zhang (yuezhang)
Assigned to: Nobody/Anonymous (nobody)
Summary: MemoryError in httplib

Initial Comment:
The problem from

http://www.thescripts.com/forum/thread25490.html

can be repeated here with python2.4.1 on WinXP. 

Test sample: sending about 5MB http data. 

It appears to be caused by line 545, httplib.py. 

            chunk = self.fp.read(amt)

It seems that reading too much from that sock causes
leak. Thus trying to edit the line making it

            chunk = self.fp.read(min(amt,50000))

the problem will be solved. //Not sure whether it was
sock error for using pure sock for http won't cause
this problem. 

If you need an example of this bug, please contact me. 

Also, the method in httplib is using string 
concatenation, which might turn slow when the strings 
are large. An alternative is using a temp list to cache 
the string sections, and join the list at last. This will be 
faster, with the draw back of some more memory 
usage. 

Best regards, 
Zhang Yue



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1296004&group_id=5470


More information about the Python-bugs-list mailing list