httprepo: decompress stream incrementally to reduce memory usage stable
authorMatt Mackall <mpm@selenic.com>
Thu, 05 Aug 2010 16:17:39 -0500
branchstable
changeset 11757 65bd4b8e48bd
parent 11756 0299240b849b
child 11758 a79214972da2
httprepo: decompress stream incrementally to reduce memory usage
mercurial/httprepo.py
--- a/mercurial/httprepo.py	Thu Aug 05 16:17:33 2010 -0500
+++ b/mercurial/httprepo.py	Thu Aug 05 16:17:39 2010 -0500
@@ -17,7 +17,9 @@
     zd = zlib.decompressobj()
     try:
         for chunk in util.filechunkiter(f):
-            yield zd.decompress(chunk)
+            while chunk:
+                yield zd.decompress(chunk, 2**18)
+                chunk = zd.unconsumed_tail
     except httplib.HTTPException:
         raise IOError(None, _('connection ended unexpectedly'))
     yield zd.flush()