Possible Duplicates:
Is it possible to have a memory leak in managed code? (specifically C# 3.0)
Memory Leak in C#
There was a similar question on this yesterday, but for Java, so I’m interested – what it takes to create a memory leak in C# / .NET (without using unsafe) ?
static events; DEADLY, since they never go out of scope.
The anonymous method is simply a nice-to-have here but are nice because they also are a pig to unsubscribe unless you take a copy into a variable/field and subscribe that.
Technically this isn’t actually “leaked”, as you can still access them via
Evil.GetInvocationList()– however, when used with regular objects this can cause unexpected object lifetimes, i.e.now the object at
objlives forever. This satisfies enough of a perceived leak IMO, and “my app died a horrible death” is good enough for me ;p