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.

classification
Title: MemoryError in httplib
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, yuezhang
Priority: normal Keywords:

Created on 2005-09-20 05:14 by yuezhang, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg26332 - (view) Author: Yue Zhang (yuezhang) Date: 2005-09-20 05:14
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

msg26333 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-09-29 20:16
Logged In: YES 
user_id=1188172

I added a "max amount" of 1 MB in httplib.py r1.96, 1.94.2.2.
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42387
2005-09-20 05:14:25yuezhangcreate