1
"""Check for memory leak in tarfile.py.
3
Before somehow reading from a _FileObject as returned by extractfile()
4
would cause a memory leak.
8
import sys, gzip, os, random
9
sys.path.insert(0, "../src")
13
#gzipfile = gzip.GzipFile("/root/.duplicity/full/duplicity-signatures.2002-08-06T22:07:07-07:00.sigtar.gz", "rb")
14
#gzipfile = os.popen("zcat /root/.duplicity/full/duplicity-signatures.2002-08-06T22:07:07-07:00.sigtar.gz")
15
gzipfile = gzip.GzipFile(None, "r", 9,
16
open("/root/.duplicity/full/duplicity-signatures.2002-08-06T22:07:07-07:00.sigtar.gz", "rb"))
17
tf = tarfile.TarFile("none", "r", gzipfile)
20
print tarinfo.name, i, tarinfo.size
23
fileobj = tf.extractfile(tarinfo)
25
buf = tf.fileobj.read(tarinfo.size)
26
tf.offset += tarinfo.size
29
gzipfile = gzip.GzipFile("/root/.duplicity/full/duplicity-signatures.2002-08-06T22:07:07-07:00.sigtar.gz", "rb")
32
buf = gzipfile.read(random.randrange(0, 500000))
33
#buf = gzipfile.read(500000)