diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2007-11-23 13:40:03 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2007-11-23 13:40:03 +0100 |
| commit | 3dc72516fe915b5ba3722b11e07fb70211169509 (patch) | |
| tree | d45474126b6a9bad8c1c1bdf276df186d04ec58f /tests | |
| parent | 14eafeeba30ccb31676769d708ad0aa681fab219 (diff) | |
| download | python-apt-3dc72516fe915b5ba3722b11e07fb70211169509.tar.gz | |
* python/progress.cc:
- fix refcount problem in OpProgress
- fix refcount problem in FetchProgress
- fix refcount problem in CdromProgress
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/refcount.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/refcount.py b/tests/refcount.py new file mode 100755 index 00000000..e8bd9c6d --- /dev/null +++ b/tests/refcount.py @@ -0,0 +1,35 @@ +#!/usr/bin/python-dbg + +from pprint import pprint,pformat +import apt +import sys +import gc +import difflib + +# get initial cache +print sys.gettotalrefcount() +progress= apt.progress.OpTextProgress() +c = apt.Cache(progress) +print "refcount after first cache instance: ", sys.gettotalrefcount() + +# test open() +c.open(progress) +print "refcount after cache open: ", sys.gettotalrefcount() +#pprint(sys.getobjects(10)) + +c.open(apt.progress.OpProgress()) +print "refcount after seconf cache open: ", sys.gettotalrefcount() +#pprint(sys.getobjects(10)) + +# FIXME: find a way to get a efficient diff +#before = gc.get_objects() +#c.open(apt.progress.OpProgress()) +#after = gc.get_objects() + + +# test update() +print "refcount before cache.update(): ", sys.gettotalrefcount() +c.update() +gc.collect() +print "refcount after cache.update(): ", sys.gettotalrefcount() +pprint(sys.getobjects(20)) |
