duplicity-team team mailing list archive
-
duplicity-team team
-
Mailing list archive
-
Message #00973
[Merge] lp:~mterry/duplicity/memleak into lp:duplicity
Michael Terry has proposed merging lp:~mterry/duplicity/memleak into lp:duplicity.
Requested reviews:
duplicity-team (duplicity-team)
Related bugs:
Bug #908228 in Duplicity: "possible memory leak"
https://bugs.launchpad.net/duplicity/+bug/908228
For more details, see:
https://code.launchpad.net/~mterry/duplicity/memleak/+merge/89498
Don't cache TarInfo files. Test still pass, so I don't believe we need the members cache (and in the old tarfile.py, we didn't cache either).
--
https://code.launchpad.net/~mterry/duplicity/memleak/+merge/89498
Your team duplicity-team is requested to review the proposed merge of lp:~mterry/duplicity/memleak into lp:duplicity.
=== modified file 'duplicity/util.py'
--- duplicity/util.py 2011-08-23 18:14:17 +0000
+++ duplicity/util.py 2012-01-20 21:52:23 +0000
@@ -71,6 +71,10 @@
else:
raise
+class BlackHoleList(list):
+ def append(self, x):
+ pass
+
class FakeTarFile:
debug = 0
def __iter__(self):
@@ -83,7 +87,12 @@
# yet. So we want to ignore ReadError exceptions, which are used to signal
# this.
try:
- return tarfile.TarFile("arbitrary", mode, fp)
+ tf = tarfile.TarFile("arbitrary", mode, fp)
+ # Now we cause TarFile to not cache TarInfo objects. It would end up
+ # consuming a lot of memory over the lifetime of our long-lasting
+ # signature files otherwise.
+ tf.members = BlackHoleList()
+ return tf
except tarfile.ReadError:
return FakeTarFile()
Follow ups