def testLeaksGencache(self):
try:
gtrc = sys.gettotalrefcount
except AttributeError:
print "Please run this with python_d for leak tests"
gtrc = lambda: 0
# note creating self.object() should have consumed our "one time" leaks
object = EnsureDispatch("Python.Test.Pippo")
start = gtrc()
for i in range(1000):
object = EnsureDispatch("Python.Test.Pippo")
object.Method1()
object = None
end = gtrc()
if end-start > 10:
self.fail("We lost %d references!" % (end-start,))
评论列表
文章目录