[Zope3-dev] Leak in zope.component?

Christian Zagrodnick cz at gocept.com
Wed Aug 22 08:16:48 EDT 2007


Hi,

I'm doing things wich z3c.zalchemy and trying to find out why my 
database connections are kept open  even after unregistering everything.

Given the following very simple test:

>>> import sys
>>> import zope.component
>>> import zope.interface
>>> class IUtil(zope.interface.Interface):
...     pass

>>> gsm = zope.component.getGlobalSiteManager()
>>> utility = object()
>>> sys.getrefcount(utility)
2
>>> gsm.registerUtility(utility, IUtil)
>>> sys.getrefcount(utility)
6

>>> gsm.unregisterUtility(utility, IUtil)
True
>>> sys.getrefcount(utility)  # this fails
2

----------------------------------------------------------------------
File 
"/Users/zagy/development/z3c.zalchemy/src/z3c/zalchemy/tests/dispose.txt", 
line 17, in dispose.txt
Failed example:
    sys.getrefcount(utility)  # this fails
Expected:
    2
Got:
    4



So there are now two more references than before register/unregister. 
Am I missing something? Or is it leaking somewhere?


-- 
Christian Zagrodnick

gocept gmbh & co. kg  ·  forsterstrasse 29 · 06112 halle/saale
www.gocept.com · fon. +49 345 12298894 · fax. +49 345 12298891





More information about the Zope3-dev mailing list