[MERGE] [Bug 215426] Re: MemoryError - recv for HTTP throughProxy
Eric Holmberg
eholmberg at arrow.com
Wed Apr 23 17:14:38 BST 2008
The updated patch is attached and I've addressed your comments below.
Sorry about the delay -- I was on travel last week and didn't get a
chance to update the patch.
John:
> I think anything above 100KB is going to be reasonable. The
> idea is that you don't want to read 1 byte at a time. I think
> Capping it at 1MB is ok, but so would 100KB or so. Probably
> even 10k might work, but my happy point would probably be 100K or 1M.
Good advice -- I set the size to 512KB.
Andrew:
> Our style guide says this line ought to be written as:
> num_bytes_to_read = min(limited, 1024*1024*4)
>
> For that matter, "lst" ought to be called something clearer, like
"byte_segments".
Done, hope this patch follows the style a little better.
> I wonder a little if a cStringIO would be a faster (and maybe clearer)
way to build up this string?
Good advice -- changed it to StringIO.
> Another comment: there's a couple of other self._file.read calls in
this class, including one in the same method.
I converted the code into a member function (_read_limited) and change
the self._file.read calls to self._read_limited. Once instance of
self._file.read on line 166 in the method _checked_read is limited to
8KB already, so I left that one.
Regards,
Eric Holmberg
Applications Engineer, Arrow Electronics
Engineering Solutions Center
Denver, Colorado
Direct: 303-824-4537, eholmberg at arrow.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bug215426-fix-v2.patch
Type: application/octet-stream
Size: 4929 bytes
Desc: bug215426-fix-v2.patch
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20080423/640efb48/attachment-0002.obj
More information about the bazaar
mailing list