summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2006-07-26 16:59:37 +0200
committerMichael Vogt <egon@bottom>2006-07-26 16:59:37 +0200
commit70c850f4910cfcb6a825c67f577d8bc554612044 (patch)
tree5321c9aa207b8743c7cca63e2b7b05609fbcddf7 /tests
parentf701fc174a88d8f2b418a032571ff40ed6fd56e6 (diff)
parent6fc084d34105f336fdf090e2dd45e402e25cfc57 (diff)
downloadpython-apt-70c850f4910cfcb6a825c67f577d8bc554612044.tar.gz
* merged from the auto-mark branch
Diffstat (limited to 'tests')
-rwxr-xr-xtests/memleak.py42
-rw-r--r--tests/pkgsrcrecords.py2
2 files changed, 43 insertions, 1 deletions
diff --git a/tests/memleak.py b/tests/memleak.py
new file mode 100755
index 00000000..3e59cbb7
--- /dev/null
+++ b/tests/memleak.py
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+import apt
+import apt_pkg
+import time
+import gc
+import sys
+
+
+cache = apt.Cache()
+
+# memleak
+#for i in range(100):
+# cache.open(None)
+# print cache["apt"].name
+# time.sleep(1)
+# gc.collect()
+
+# memleak
+#for i in range(100):
+# cache = apt.Cache()
+# time.sleep(1)
+# cache = None
+# gc.collect()
+
+# no memleak, but more or less the apt.Cache.open() code
+for i in range(100):
+ cache = apt_pkg.GetCache()
+ depcache = apt_pkg.GetDepCache(cache)
+ records = apt_pkg.GetPkgRecords(cache)
+ list = apt_pkg.GetPkgSourceList()
+ list.ReadMainList()
+ dict = {}
+ for pkg in cache.Packages:
+ if len(pkg.VersionList) > 0:
+ dict[pkg.Name] = apt.Package(cache,depcache,
+ records, list, None, pkg)
+
+ print cache["apt"]
+ time.sleep(1)
+
+ gc.collect()
diff --git a/tests/pkgsrcrecords.py b/tests/pkgsrcrecords.py
index dc4881dd..28df3f7c 100644
--- a/tests/pkgsrcrecords.py
+++ b/tests/pkgsrcrecords.py
@@ -14,7 +14,7 @@ def main():
print "Running PkgSrcRecords test on all packages:"
for x in cache.Packages:
i += 1
- src = apt_pkg.GetPkgSrcRecords(cache)
+ src = apt_pkg.GetPkgSrcRecords()
if src.Lookup(x.Name):
#print src.Package
pass