[Python-Dev] We got leaks!
Tim Peters
tim.one@comcast.net
Fri, 06 Dec 2002 18:20:42 -0500
[Kevin Jacobs]
> First minimal test case:
>
> class Leaker(object):
> def __hash__(self): return 1
>
> for i in range(10):
> hash( Leaker() )
> print '*' * 10, 'total refs:', sys.gettotalrefcount()
>
> In the context of the datetime objects, this leak only affects the
> Python version. It also requires that the Leaker class is a new-style
> object.
Outstanding! Thanks, Kevin. I note that this variant shows the same
growth:
x = Leaker()
for i in range(10):
hash(x)
print '*' * 10, 'total refs:', sys.gettotalrefcount()
> I'm in the process of isolating the other leak that hits both the
> Python and C verions of datetime in the test_pickling() function,
> though I suspect that may be other incarnations of the above problem.
Possibly. I'll try to figure out what's going on above first.
> Fun, fun!
The thrill fades a bit after the three hundredth time <wink>.