[laszlo-reviews -> laszlo-dev] On 2010-03-14, at 08:59, André Bargull wrote:
> 1) delegates will now leak memory until their context is destroyed It occurs to me that we could avoid the delegate leakage issue and at the same time simplify this problem. We really only need to manage delegates and events that connect different nodes. Delegates and events where the event sender and the delegate context are the same don't need to be cleaned up because they will just be dropped when the node is dropped. So what we really need is when a delegate is registered on an event, if (and only if) the event sender is different from the delegate context, we record the event in two places: 1) In the delegate context, in the "inbound event" table (events inbound to me that are from other nodes) 2) In the event sender, in the "outbound event" table (events outbound from me to other nodes) When a node is destroyed: 1) Iterate over the inbound event table, removing any delegates from those events that have me as a context 2) Iterate over the outbound event table, removing all delegates (no harm in removing my own). Comments? --- While this is a simpler solution to the event/delegate leakage problem, it means that same mechanism no longer can be overloaded to handle constraint management in states, layouts, and replicators. But maybe that is a good thing.
