May I refer you to this post.
Also, I have my PMs enabled now, so what is it you wanted to say?
Addendum: Perhaps the mods can add the words "Memory Leak" to the bad words filter for the C# forum.
Printable View
May I refer you to this post.
Also, I have my PMs enabled now, so what is it you wanted to say?
Addendum: Perhaps the mods can add the words "Memory Leak" to the bad words filter for the C# forum.
Is the philosophy of .NET not to avoid mem leaks by using the Garbage Collector?
I thought that .NET takes care about used memory and releases it, if
required.
So for .NET developers no memory leaks can occur.
If I'm wrong, tell me.
1) NEVER trust WikiPedia...It is often a good starting point, but a many (most?) items contain at least one (typically minor) in-accuracy...
In the case of the "dangling event", it will does not meet the criteria as it does not satisify the "no longer needs" portion.
If I terminate my means of accdepting the notification, I would be in violation of the contract. I must (legally) keep the means of communication open.Code:1) WE sign a contract that you will notify me of certain facts when something happens.
2) Time passes, and I no longer care about this, but do NOT inform you and have the contract terminated (along with any side effects of the termination)
3) YOU still have the responsibility of notifying me.
4) I still have the responsibility of accepting that notification.
Now if we translate this into the "event" issue, we see the same exact condition. The object is question (the one with no references OTHER THAN the contractual reference in the delegate) is OBLIGATED to remain in existance. It is STILL REQUIRED.
To go to a more general case, consider that EVERY object "exists" for a period of time in .NET after it is no longer needed (from the removal of the last reference to the object, until the GC runs for the generation which owns the object. From a programmers perspective, the object is "no longer needed". But this is not considered a leak....