Merge lp:~mterry/duplicity/memleak into lp:duplicity/0.6

Proposed by Michael Terry
Status: Merged
Merged at revision: 826
Proposed branch: lp:~mterry/duplicity/memleak
Merge into: lp:duplicity/0.6
Diff against target: 27 lines (+10/-1)
1 file modified
duplicity/util.py (+10/-1)
To merge this branch: bzr merge lp:~mterry/duplicity/memleak
Reviewer Review Type Date Requested Status
duplicity-team Pending
Review via email: mp+89498@code.launchpad.net

Description of the change

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).

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'duplicity/util.py'
--- duplicity/util.py 2011-08-23 18:14:17 +0000
+++ duplicity/util.py 2012-01-20 21:55:27 +0000
@@ -71,6 +71,10 @@
71 else:71 else:
72 raise72 raise
7373
74class BlackHoleList(list):
75 def append(self, x):
76 pass
77
74class FakeTarFile:78class FakeTarFile:
75 debug = 079 debug = 0
76 def __iter__(self):80 def __iter__(self):
@@ -83,7 +87,12 @@
83 # yet. So we want to ignore ReadError exceptions, which are used to signal87 # yet. So we want to ignore ReadError exceptions, which are used to signal
84 # this.88 # this.
85 try:89 try:
86 return tarfile.TarFile("arbitrary", mode, fp)90 tf = tarfile.TarFile("arbitrary", mode, fp)
91 # Now we cause TarFile to not cache TarInfo objects. It would end up
92 # consuming a lot of memory over the lifetime of our long-lasting
93 # signature files otherwise.
94 tf.members = BlackHoleList()
95 return tf
87 except tarfile.ReadError:96 except tarfile.ReadError:
88 return FakeTarFile()97 return FakeTarFile()
8998

Subscribers

People subscribed via source and target branches

to all changes: