summaryrefslogtreecommitdiff
path: root/community/duplicity/duplicity-0.6.17-fix-memleak.patch
blob: 1c4c8daff18c0a5a74ec6076846ed43831f0fa72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
=== modified file 'duplicity/util.py'
--- duplicity/util.py	2011-08-23 18:14:17 +0000
+++ duplicity/util.py	2012-01-20 21:50:01 +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()