[IronPython] IP as a Macro Language

Dino Viehland dinov at exchange.microsoft.com
Fri Apr 18 18:22:07 CEST 2008


FYI that bug should be fixed in 2.0. We now use weak references on both the handler and the target so we don't keep things alive.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Friday, April 18, 2008 8:21 AM
To: Discussion of IronPython
Subject: Re: [IronPython] IP as a Macro Language

Curt Hagenlocher wrote:
> On Fri, Apr 18, 2008 at 2:00 AM, Dave Moor <d.moor at sim-soft.co.uk> wrote:
>
>> My problem is, I can create a form entirely in IP but I can't seem to
>> get it added as a MDIChild to the main application, and when the form is
>> closed the form's timer is still running in the background requesting
>> data from the main application.
>>
>
> For the most part, anything you can do along these lines from C# can
> also be done from within IronPython.  Can you provide a snippet of
> Python code that shows the approach that wasn't working for you?
>
>
>> I gather from this list that IP has problems destroying C# objects it
>> has instantiated and I assume that it has problems responding to events
>> triggered from the CLR side.
>>
>
> Both IronPython and C# rely on the same underlying CLR garbage
> collector, so there really shouldn't be any difference in this regard.
>  Could you be storing a reference to the form from Python code which
> would prevent garbage collection?  For instance, if you assign the
> form to a module-level variable, it will probably never be destroyed
> because the module itself is kept alive by a reference from
> sys.modules.
>
We also had an issue where adding python functions/methods as event
handlers would keep forms alive as IronPython stores a mapping of
handler functions to delegates.

Explicitly unsubscribing to events on disposal solved that problem - but
it was a lot of work.

Michael

> --
> Curt Hagenlocher
> curt at hagenlocher.org
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list