[IronPython] shall #14454 be fixed for 1.X ?

Dino Viehland dinov at exchange.microsoft.com
Tue Apr 22 17:19:33 CEST 2008

It shouldn't cause the lambda's to be lost.  The picture ends up looking like:

+-----------+                   +-----------+
| Object W/ |                   |           |
| Event  ---+- strong ref---->  | Lambda    |
+-----------+                   +-----------+

| Dictionary                           |
| KeyValuePair 0:                    |
|    Key: WeakRef -> Object W/ Event |
|    Value: WeakRef -> Lambda        |

So long as your object w/ an event remains rooted it has a strong reference to the lambda.  If the reference to the object w/ the event is lost then both objects can be collected.

It should be fairly straight forward to port this back to 1.1.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Tuesday, April 22, 2008 3:25 AM
To: Discussion of IronPython
Subject: Re: [IronPython] shall #14454 be fixed for 1.X ?

Sakesun Roykiattisak wrote:

>The 2.0beta is not stable enough for me to work with yet.
>But 1.1 is leaking memory and not applicable for long running server
>Wonder how hard to fix #14454 in 1.1 ?

Note that you can 'fix' this yourself by unsubscribing from events when
you have finished with them.

It would be nice to see this fixed - so long as it doesn't cause
problems when you use lambda functions (or other functions that you
aren't directly keeping a reference to) as event handlers.

Michael Foord

>Users mailing list
>Users at lists.ironpython.com

Users mailing list
Users at lists.ironpython.com

More information about the Ironpython-users mailing list