changeset 11757:65bd4b8e48bd stable

httprepo: decompress stream incrementally to reduce memory usage
author Matt Mackall <mpm@selenic.com>
date Thu, 05 Aug 2010 16:17:39 -0500
parents 0299240b849b
children a79214972da2
files mercurial/httprepo.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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()