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
1=== modified file 'duplicity/util.py'
2--- duplicity/util.py 2011-08-23 18:14:17 +0000
3+++ duplicity/util.py 2012-01-20 21:55:27 +0000
4@@ -71,6 +71,10 @@
5 else:
6 raise
7
8+class BlackHoleList(list):
9+ def append(self, x):
10+ pass
11+
12 class FakeTarFile:
13 debug = 0
14 def __iter__(self):
15@@ -83,7 +87,12 @@
16 # yet. So we want to ignore ReadError exceptions, which are used to signal
17 # this.
18 try:
19- return tarfile.TarFile("arbitrary", mode, fp)
20+ tf = tarfile.TarFile("arbitrary", mode, fp)
21+ # Now we cause TarFile to not cache TarInfo objects. It would end up
22+ # consuming a lot of memory over the lifetime of our long-lasting
23+ # signature files otherwise.
24+ tf.members = BlackHoleList()
25+ return tf
26 except tarfile.ReadError:
27 return FakeTarFile()
28

Subscribers

People subscribed via source and target branches

to all changes: