[IronPython] object lifecycle issues

William Reade william at resolversystems.com
Tue Jul 21 18:19:52 CEST 2009


Dino Viehland wrote:
> #2 I'd guess could be either that for some reason we're failing to
> detect the presence of __del__ or that when we run the finalizer cleanup
> that we believe it's part of cyclic trash and don't think we should cleanup.
> Of those I'd think it'd be the cyclic trash detection that'd be most
> likely to go wrong.
>
> I'd suggest putting a break point or some logging in
> PythonOps.InitializeForFinalization and in WeakRefTracker's finalizer
> and see what's happening there.
>   

In PythonOps.InitializeForFinalization, I see 2 InstanceFinalizers 
created for each object; one after the stub __new__, and one after the 
real __new__. Each IF creates a WeakRefTracker as expected; in both 
cases, the second WRT (and only the second one) is subsequently 
GC.SuppressFinalized in SetFinalizerWorker. However, in the broken 
cases, the WRT finalizer just never gets called.

I'll keep hunting, but it seemed worth posting this in case it rang any 
bells.

Cheers
william





More information about the Ironpython-users mailing list