(X) Hide this
    • Login
    • Join
      • Say No Bots Generate New Image
        By clicking 'Register' you accept the terms of use .
        Login with Facebook

LeakEvent -> WeakEvent in Silverlight

(1 votes)
0 comments   /   posted by Silverlight Show on Feb 02, 2012
Tags:   silverlight-5 , viewmodel , shimmy-weitzhandler

Read original post by Shimmy Weitzhandler at Shimmy on .NET

I'm sure not every Silverlight (or any) developer is aware of the fact that when one subscribes to an event, a strong reference to the handler class ('target') is attached to the event source ('source'), hence, if the source object life-cycle is longer than the target, memory is leaked, becuase when you don't need the target anymore and all its references are removed, there is still one reference to it by that event handler in the source, and thus, won't get collected by GC.

A strong reference is a normal reference that protects the referred object from collection by a garbage collector. The term is used to distinguish the reference from weak references.

If you're using Silverlight you must have encountered this scenario before.


Comments

No comments

Add Comment

Login to comment:
  *      *       
Login with Facebook

Our News on Twitter