Rev 3693: Purge the list buffer when we have a simple string buffer. in http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/sftp_chunked

John Arbash Meinel john at arbash-meinel.com
Wed Sep 10 18:21:35 BST 2008


At http://bzr.arbash-meinel.com/branches/bzr/1.8-dev/sftp_chunked

------------------------------------------------------------
revno: 3693
revision-id: john at arbash-meinel.com-20080910172134-os9otcyg1rdbgi0s
parent: john at arbash-meinel.com-20080905212334-69j0qvvr9trvfk1b
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: sftp_chunked
timestamp: Wed 2008-09-10 12:21:34 -0500
message:
  Purge the list buffer when we have a simple string buffer.
-------------- next part --------------
=== modified file 'bzrlib/transport/sftp.py'
--- a/bzrlib/transport/sftp.py	2008-09-04 03:03:27 +0000
+++ b/bzrlib/transport/sftp.py	2008-09-10 17:21:34 +0000
@@ -246,6 +246,9 @@
                 # when there is only one string ''.join([x]) == x, so there is
                 # no data copying.
                 buffered = ''.join(buffered_data)
+                # Clean out buffered data so that we keep memory
+                # consumption low
+                del buffered_data[:]
                 buffered_offset = 0
                 # TODO: We *could* also consider the case where cur_offset is in
                 #       in the buffered range, even though it doesn't *start*
@@ -276,6 +279,7 @@
                     buffered_len = len(buffered)
         if buffered_len:
             buffered = ''.join(buffered_data)
+            del buffered_data[:]
             data_chunks.append((input_start, buffered))
         if data_chunks:
             mutter('SFTP readv left with %d out-of-order bytes',



More information about the bazaar-commits mailing list